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

// ─── Dishes ───────────────────────────────────────────────────────────────────
export const dishApi = {
  getList: (params) => request.get('/meal/dishes', { params }),
  getDetail: (id) => request.get(`/meal/dishes/${id}`),
  create: (data) => request.post('/meal/dishes', data),
  update: (id, data) => request.put(`/meal/dishes/${id}`, data),
  delete: (id) => request.delete(`/meal/dishes/${id}`)
}

// ─── Meal Plan Templates ──────────────────────────────────────────────────────
export const mealTemplateApi = {
  getList: (params) => request.get('/meal/templates', { params }),
  getDetail: (id) => request.get(`/meal/templates/${id}`),
  create: (data) => request.post('/meal/templates', data),
  update: (id, data) => request.put(`/meal/templates/${id}`, data),
  delete: (id) => request.delete(`/meal/templates/${id}`)
}

// ─── Daily Meal Plans ─────────────────────────────────────────────────────────
export const dailyMealPlanApi = {
  getList: (params) => request.get('/meal/daily-plans', { params }),
  getDetail: (id) => request.get(`/meal/daily-plans/${id}`),
  create: (data) => request.post('/meal/daily-plans', data),
  update: (id, data) => request.put(`/meal/daily-plans/${id}`, data),
  delete: (id) => request.delete(`/meal/daily-plans/${id}`),
  deliver: (id) => request.put(`/meal/daily-plans/${id}/deliver`),
  updateStatus: (id, data) => request.put(`/meal/daily-plans/${id}/status`, data)
}

// ─── Meal Reviews ─────────────────────────────────────────────────────────────
export const mealReviewApi = {
  getList: (params) => request.get('/meal/reviews', { params }),
  getDetail: (id) => request.get(`/meal/reviews/${id}`),
  create: (data) => request.post('/meal/reviews', data)
}
