import api from "src/api";

export const getUnitPackages = async () => {
  const { data } = await api.get("/franchisee/packages");
  return data.payload;
};

export const getAllUnitPackages = async () => {
  const { data } = await api.get("/selects/franchisee/packages");
  return data.payload;
};

export const getUnitPackagesForSelect = async () => {
  const { data } = await api.get("/selects/franchisee/packages");
  return data.payload;
};

export const getUnitPackage = async (id) => {
  const { data } = await api.get(`/franchisee/packages/${id}`);
  return data.payload;
};

export const createUnitPackage = async (payload) => {
  const { data } = await api.post("/franchisee/packages", payload);
  return data.payload;
};

export const updateUnitPackage = async (id, payload) => {
  const { data } = await api.put(`/franchisee/packages/${id}`, payload);
  return data.payload;
};

export const toggleUnitPackageVisibility = async (id) => {
  const { data } = await api.patch(`/franchisee/packages/${id}/visibility`);
  return data.payload;
};

export const deleteUnitPackage = async (id) => {
  await api.delete(`/franchisee/packages/${id}`);
};
