import api from "src/api";

export const getUnitPackages = async () => {
  const { data } = await api.get("/class-package-unit/visible");
  return data.payload;
};

export const getAllUnitPackages = async () => {
  const { data } = await api.get("/class-package-unit");
  return data.payload;
};

export const getUnitPackage = async (id) => {
  const { data } = await api.get(`/class-package-unit/${id}`);
  return data.payload;
};

export const createUnitPackage = async (payload) => {
  const { data } = await api.post("/class-package-unit", payload);
  return data.payload;
};

export const updateUnitPackage = async (id, payload) => {
  const { data } = await api.put(`/class-package-unit/${id}`, payload);
  return data.payload;
};

export const toggleUnitPackageVisibility = async (id) => {
  const { data } = await api.patch(`/class-package-unit/${id}/toggle-visibility`);
  return data.payload;
};

export const deleteUnitPackage = async (id) => {
  await api.delete(`/class-package-unit/${id}`);
};
