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

// ─── KB Categories ───────────────────────────────────────────────────────────
export const kbCategoryApi = {
  getList: (params) => request.get('/kb/categories', { params }),
  getDetail: (id) => request.get(`/kb/categories/${id}`),
  create: (data) => request.post('/kb/categories', data),
  update: (id, data) => request.put(`/kb/categories/${id}`, data),
  delete: (id) => request.delete(`/kb/categories/${id}`)
}

// ─── KB Articles ─────────────────────────────────────────────────────────────
export const kbArticleApi = {
  getList: (params) => request.get('/kb/articles', { params }),
  getDetail: (id) => request.get(`/kb/articles/${id}`),
  create: (data) => request.post('/kb/articles', data),
  update: (id, data) => request.put(`/kb/articles/${id}`, data),
  delete: (id) => request.delete(`/kb/articles/${id}`),
  publish: (id) => request.put(`/kb/articles/${id}/publish`),
  offline: (id) => request.put(`/kb/articles/${id}/offline`)
}
