import request from '@/utils/request'

// 查询案例列表
export function listCases(params) {
  return request({
    url: '/api/cases',
    method: 'get',
    params
  })
}

// 获取案例详情
export function getCase(id) {
  return request({
    url: `/api/cases/${id}`,
    method: 'get'
  })
}

// 新增案例
export function addCase(data) {
  return request({
    url: '/api/cases',
    method: 'post',
    data
  })
}

// 修改案例
export function updateCase(id, data) {
  return request({
    url: `/api/cases/${id}`,
    method: 'put',
    data
  })
}

// 删除案例
export function deleteCase(id) {
  return request({
    url: `/api/cases/${id}`,
    method: 'delete'
  })
}

// 标记为典型案例
export function markTypical(id) {
  return request({
    url: `/api/cases/${id}/mark-typical`,
    method: 'post'
  })
}

// 取消典型案例标记
export function unmarkTypical(id) {
  return request({
    url: `/api/cases/${id}/unmark-typical`,
    method: 'post'
  })
}

// 查询典型案例列表
export function listTypicalCases() {
  return request({
    url: '/api/cases/typical',
    method: 'get'
  })
}

