import http from "../http-common";

const getAll = (status) => {
  const params = {};
  if (status) {
    params.status = status;
  }
  return http.get("/attendance-notes", { params });
};

const getAttendanceNote = (id) => {
  return http.get(`/attendance-notes/${id}`);
};

const createNewAttendanceNote = (data) => {
  return http.post('/attendance-notes', data);
};

const updateAttendanceNote = (id, data) => {
  return http.put(`/attendance-notes/${id}`, data);
};

const deleteAttendanceNote = (id) => {
  return http.delete(`/attendance-notes/${id}`);
};

const uploadAttendanceNoteFile = (data, noteId, name, fileType) => {
  return http.post(`/files/upload-physical?objectId=${noteId}&name=${name}&fileType=${fileType}&model=attendance_note`, data);
};

const getAllAttendanceNoteFiles = (noteId, name, fileType) => {
  return http.get(`/files/uploadedDocs/attendance_note/${noteId}/type/${fileType}/name/${name}`);
};

export const AttendanceNoteService = {
  getAll,
  getAttendanceNote,
  createNewAttendanceNote,
  updateAttendanceNote,
  deleteAttendanceNote,
  uploadAttendanceNoteFile,
  getAllAttendanceNoteFiles
}; 