import request from '@/utils/request'

// 查询文档列表
export function listKnowledgeDocuments(params) {
  return request({
    url: '/api/knowledge/documents',
    method: 'get',
    params
  })
}

// 获取文档详情
export function getKnowledgeDocument(id) {
  return request({
    url: `/api/knowledge/documents/${id}`,
    method: 'get'
  })
}

// 新增文档
export function addKnowledgeDocument(data) {
  return request({
    url: '/api/knowledge/documents',
    method: 'post',
    data
  })
}

// 修改文档
export function updateKnowledgeDocument(id, data) {
  return request({
    url: `/api/knowledge/documents/${id}`,
    method: 'put',
    data
  })
}

// 删除文档
export function deleteKnowledgeDocument(id) {
  return request({
    url: `/api/knowledge/documents/${id}`,
    method: 'delete'
  })
}

// 下载文档
export function downloadKnowledgeDocument(id) {
  return request({
    url: `/api/knowledge/documents/${id}/download`,
    method: 'get',
    responseType: 'blob'
  })
}

// 推荐文档
export function recommendKnowledgeDocuments(params) {
  return request({
    url: '/api/knowledge/documents/recommend',
    method: 'get',
    params
  })
}

