import api from "src/api";

export const getActiveFranchiseeContracts = async () => {
  const { data } = await api.get("/franchisee-contract/active");
  return data.payload;
};

export const getFranchiseeContractsByUnit = async (unitId) => {
  const { data } = await api.get("/franchisee-contract", {
    params: { unit_id: unitId },
  });
  return data.payload;
};

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

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

export const deleteFranchiseeContract = async (id) => {
  const { data } = await api.delete(`/franchisee-contract/${id}`);
  return data;
};

export const getFranchiseeContractTaxHistory = async (id) => {
  const { data } = await api.get(`/franchisee-contract/${id}/tax-history`);
  return data.payload;
};
