import ApiService from "@/services/ApiService";

const catBase = "admin/laundry-sale-categories";
const prodBase = "admin/laundry-sale-products";

export async function listCategories() {
  const response = await ApiService.get(catBase);
  return response.data;
}

export async function createCategory(payload) {
  const response = await ApiService.post(catBase, payload);
  return response.data;
}

export async function updateCategory(id, payload) {
  const response = await ApiService.put(`${catBase}/${id}`, payload);
  return response.data;
}

export async function disableCategory(id) {
  const response = await ApiService.patch(`${catBase}/${id}/disable`);
  return response.data;
}

export async function listProducts() {
  const response = await ApiService.get(prodBase);
  return response.data;
}

export async function createProduct(payload) {
  const response = await ApiService.post(prodBase, payload);
  return response.data;
}

export async function updateProduct(id, payload) {
  const response = await ApiService.put(`${prodBase}/${id}`, payload);
  return response.data;
}

export async function disableProduct(id) {
  const response = await ApiService.patch(`${prodBase}/${id}/disable`);
  return response.data;
}
