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

// ─── Room Types ───────────────────────────────────────────────────────────────
export const roomTypeApi = {
  getList: (params) => request.get('/room/room-types', { params }),
  getDetail: (id) => request.get(`/room/room-types/${id}`),
  create: (data) => request.post('/room/room-types', data),
  update: (id, data) => request.put(`/room/room-types/${id}`, data),
  delete: (id) => request.delete(`/room/room-types/${id}`)
}

// ─── Rooms ────────────────────────────────────────────────────────────────────
export const roomApi = {
  getList: (params) => request.get('/room/rooms', { params }),
  getDetail: (id) => request.get(`/room/rooms/${id}`),
  create: (data) => request.post('/room/rooms', data),
  update: (id, data) => request.put(`/room/rooms/${id}`, data),
  delete: (id) => request.delete(`/room/rooms/${id}`),
  updateStatus: (id, data) => request.put(`/room/rooms/${id}/status`, data)
}

// ─── Reservations ─────────────────────────────────────────────────────────────
export const reservationApi = {
  getList: (params) => request.get('/room/reservations', { params }),
  getDetail: (id) => request.get(`/room/reservations/${id}`),
  create: (data) => request.post('/room/reservations', data),
  update: (id, data) => request.put(`/room/reservations/${id}`, data),
  delete: (id) => request.delete(`/room/reservations/${id}`),
  checkIn: (id) => request.put(`/room/reservations/${id}/check-in`),
  checkOut: (id) => request.put(`/room/reservations/${id}/check-out`),
  cancel: (id, data) => request.put(`/room/reservations/${id}/cancel`, data)
}

// ─── Customer Outings ─────────────────────────────────────────────────────────
export const customerOutingApi = {
  getList: (params) => request.get('/room/customer-outings', { params }),
  getDetail: (id) => request.get(`/room/customer-outings/${id}`),
  create: (data) => request.post('/room/customer-outings', data),
  recordBack: (id, data) => request.put(`/room/customer-outings/${id}/back`, data)
}

// ─── Call Records ─────────────────────────────────────────────────────────────
export const callRecordApi = {
  getList: (params) => request.get('/room/call-records', { params }),
  create: (data) => request.post('/room/call-records', data),
  handle: (id, data) => request.put(`/room/call-records/${id}/handle`, data)
}
