import api from "src/api";

export const getStudentMedias = async (studentId) => {
  const { data } = await api.get("/student-media", { params: { student_id: studentId } });
  return data.payload;
};

export const getContractMedias = async (contractId) => {
  const { data } = await api.get("/student-media", { params: { student_contract_id: contractId } });
  return data.payload;
};

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

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

export const deleteStudentMedia = async (id) => {
  const { data } = await api.delete(`/student-media/${id}`);
  return data;
};
