import api from "src/api";

export const getFranchiseeReceivables = async (params = {}) => {
  const { data } = await api.get("/franchisee-account-receive", { params });
  return data.payload;
};

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

export const settleFranchiseeReceivable = async (id, payload = {}) => {
  const { data } = await api.post(`/franchisee-account-receive/${id}/settle`, payload);
  return data.payload;
};

export const chargeFranchiseeReceivable = async (id) => {
  const { data } = await api.post(`/franchisee-account-receive/${id}/charge`);
  return data.payload;
};

export const reopenFranchiseeReceivable = async (id) => {
  const { data } = await api.post(`/franchisee-account-receive/${id}/reopen`);
  return data.payload;
};
