import request from '@/utils/request.js'

// ─── Employee Profiles ───────────────────────────────────────────────────────
export const employeeProfileApi = {
  getList: (params) => request.get('/hr/profiles', { params }),
  getDetail: (id) => request.get(`/hr/profiles/${id}`),
  create: (data) => request.post('/hr/profiles', data),
  update: (id, data) => request.put(`/hr/profiles/${id}`, data),
  delete: (id) => request.delete(`/hr/profiles/${id}`)
}

// ─── Schedules ───────────────────────────────────────────────────────────────
export const scheduleApi = {
  getList: (params) => request.get('/hr/schedules', { params }),
  create: (data) => request.post('/hr/schedules', data)
}

// ─── Attendance Records ──────────────────────────────────────────────────────
export const attendanceApi = {
  getList: (params) => request.get('/hr/attendances', { params }),
  create: (data) => request.post('/hr/attendances', data),
  clockIn: () => request.post('/hr/attendances/clock-in'),
  clockOut: () => request.post('/hr/attendances/clock-out')
}

// ─── Leave Requests ──────────────────────────────────────────────────────────
export const leaveRequestApi = {
  getList: (params) => request.get('/hr/leaves', { params }),
  getDetail: (id) => request.get(`/hr/leaves/${id}`),
  create: (data) => request.post('/hr/leaves', data),
  update: (id, data) => request.put(`/hr/leaves/${id}`, data),
  delete: (id) => request.delete(`/hr/leaves/${id}`),
  audit: (id, data) => request.put(`/hr/leaves/${id}/audit`, data)
}

// ─── Salary Records ──────────────────────────────────────────────────────────
export const salaryRecordApi = {
  getList: (params) => request.get('/hr/salaries', { params }),
  getDetail: (id) => request.get(`/hr/salaries/${id}`),
  create: (data) => request.post('/hr/salaries', data),
  update: (id, data) => request.put(`/hr/salaries/${id}`, data),
  delete: (id) => request.delete(`/hr/salaries/${id}`),
  confirm: (id) => request.put(`/hr/salaries/${id}/confirm`),
  pay: (id) => request.put(`/hr/salaries/${id}/pay`)
}
