import api from "src/api";

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

export const getMyServicePackages = async () => {
  const { data } = await api.get("/service-packages/me");
  return data.payload;
};

export const getServicePackage = async (servicePackageId) => {
  const { data } = await api.get(`/service-packages/${servicePackageId}`);
  return data.payload;
};

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

export const createMyServicePackage = async (payload) => {
  const { data } = await api.post("/service-packages/me", payload);
  return data.payload;
};

export const createScheduleServicePackage = createMyServicePackage;

export const updateServicePackage = async (servicePackageId, payload) => {
  const { data } = await api.put(`/service-packages/${servicePackageId}`, payload);
  return data.payload;
};

export const deleteServicePackage = async (servicePackageId) => {
  const { data } = await api.delete(`/service-packages/${servicePackageId}`);
  return data.payload;
};

export const createServicePackageItem = async (payload) => {
  const { data } = await api.post("/service-package-items", payload);
  return data.payload;
};

export const updateServicePackageItem = async (servicePackageItemId, payload) => {
  const { data } = await api.put(`/service-package-items/${servicePackageItemId}`, payload);
  return data.payload;
};

export const deleteServicePackageItem = async (servicePackageItemId) => {
  const { data } = await api.delete(`/service-package-items/${servicePackageItemId}`);
  return data.payload;
};
