import api from "src/api";

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

export const createPartner = async (formData) => {
  const { data } = await api.post("/unit-partner", formData, {
    headers: { "Content-Type": "multipart/form-data" },
  });
  return data.payload;
};

export const updatePartner = async (id, formData) => {
  formData.append("_method", "PUT");
  const { data } = await api.post(`/unit-partner/${id}`, formData, {
    headers: { "Content-Type": "multipart/form-data" },
  });
  return data.payload;
};

export const deletePartner = async (id) => {
  const { data } = await api.delete(`/unit-partner/${id}`);
  return data;
};
