import { api } from "../utils/axiosClient";

export const PurchaseRepository = {
  CreatePurchase: (data) => api.post("/api/PurchaseInvoice/create", data),
  GetPurchaseList: (pageSize, pageNumber, isActive, filter, searchString) =>
    api.get(
      `/api/PurchaseInvoice/list?pageSize=${pageSize}&pageNumber=${pageNumber}&isActive=${isActive}&filter=${filter}&searchString=${searchString}`
    ),

  GetPurchase: (id) => api.get(`/api/PurchaseInvoice/details/${id}`),
  UpdatePurchase: (id, data) =>
    api.patch(`/api/PurchaseInvoice/edit/${id}`, data),
  GetDeliveryChallan: (purchaseInvoiceId) =>
    api.get(`/api/PurchaseInvoice/delivery-challan/list/${purchaseInvoiceId}`),
  addDelievryChallan: (data) =>
    api.post(`/api/PurchaseInvoice/delivery-challan/create`, data),

  AddPayment: (data) => api.post(`/api/PurchaseInvoice/add/payment`, data),
  GetPaymentHistory: (purchaseInvoiceId) =>
    api.get(`/api/PurchaseInvoice/payment-history/list/${purchaseInvoiceId}`),
  deletePurchase: (id, isActive = false) =>
    api.delete(`/api/PurchaseInvoice/delete/${id}?isActive=${isActive}`),
};

//  const filterPayload = JSON.stringify({
//       sortFilters,
//       groupByColumn: groupBy || null,
//     });
