import request from '@/utils/request'

// 查询所有租户文章列表
export function listAllArticles(query) {
  return request({
    url: '/admin/article/list',
    method: 'get',
    params: query
  })
}

// 查询待审计文章列表
export function listPendingArticles() {
  return request({
    url: '/admin/article/pending',
    method: 'get'
  })
}

// 根据租户ID查询文章列表
export function listByCompany(companyId) {
  return request({
    url: '/admin/article/byCompany/' + companyId,
    method: 'get'
  })
}

// 获取文章详情
export function getArticleInfo(articleId) {
  return request({
    url: '/admin/article/' + articleId,
    method: 'get'
  })
}

// 审计文章
export function auditArticle(articleId, status, auditRemark) {
  return request({
    url: '/admin/article/audit/' + articleId,
    method: 'put',
    params: { status, auditRemark }
  })
}

// 删除文章
export function deleteArticle(articleId) {
  return request({
    url: '/admin/article/' + articleId,
    method: 'delete'
  })
}

// 导出文章
export function exportAllArticles(query) {
  return request({ url: '/admin/article/export', method: 'get', params: query })
}
export function getArticleStatistics() {
  return request({
    url: '/admin/article/statistics',
    method: 'get'
  })
}