import request from '@/utils/request'

// 创建政策沟通交流
export function createPolicyCommunications(data) {
  return request({
    url: '/server/policy-communications/create',
    method: 'post',
    data: data
  })
}

// 更新政策沟通交流
export function updatePolicyCommunications(data) {
  return request({
    url: '/server/policy-communications/update',
    method: 'post',
    data: data
  })
}
// 更新政策沟通交流
export function updateStatusPolicyCommunications(data) {
  return request({
    url: '/server/policy-communications/updateStatus',
    method: 'post',
    data: data
  })
}

// 删除政策沟通交流
export function deletePolicyCommunications(id) {
  return request({
    url: '/server/policy-communications/delete?id=' + id,
    method: 'post'
  })
}

// 获得政策沟通交流
export function getPolicyCommunications(id) {
  return request({
    url: '/server/policy-communications/get?id=' + id,
    method: 'get'
  })
}

// 获得政策沟通交流分页
export function getPolicyCommunicationsPage(params) {
  return request({
    url: '/server/policy-communications/page',
    method: 'get',
    params
  })
}
// 导出政策沟通交流 Excel
export function exportPolicyCommunicationsExcel(params) {
  return request({
    url: '/server/policy-communications/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
// 排序
export async function updatePolicyCommunicationsSort(data) {
  return request({
    url: '/server/policy-communications/update-sort',
    method: 'post',
    data: data
  })
}
// 在 api/server/policycommunications.js 中添加
export async function batchUpdateSort(data) {
  return request({
    url: '/server/policy-communications/batch-update-sort',
    method: 'post',
    data: data
  })
}

// 在你的 PolicyCommunicationsApi.js 中添加
export function getPendingPolicyCommunicationsPage(queryParams) {
  return request({
    url: '/server/policy-communications/pending/page',
    method: 'get',
    params: queryParams
  })
}

export function getRepliedPolicyCommunicationsPage(queryParams) {
  return request({
    url: '/server/policy-communications/replied/page',
    method: 'get',
    params: queryParams
  })
}

export function getPublishedPolicyCommunicationsPage(queryParams) {
  return request({
    url: '/server/policy-communications/published/page',
    method: 'get',
    params: queryParams
  })
}
export function getRejectedPolicyCommunicationsPage(queryParams) {
  return request({
    url: '/server/policy-communications/rejected/page',
    method: 'get',
    params: queryParams
  })
}



// 统计分析相关API
export function getAnalysisKpi(params) {
  return request({
    url: '/server/policy-communications/analysis/kpi',
    method: 'get',
    params
  });
}

export function getPolicyRank(params) {
  return request({
    url: '/server/policy-communications/analysis/policy-rank',
    method: 'get',
    params
  });
}

export function getTrendAnalysis(params) {
  return request({
    url: '/server/policy-communications/analysis/trend',
    method: 'get',
    params
  });
}

export function getDepartmentAnalysis(params) {
  return request({
    url: '/server/policy-communications/analysis/department',
    method: 'get',
    params
  });
}

export function getOvertimeList(params) {
  return request({
    url: '/server/policy-communications/analysis/overtime',
    method: 'get',
    params
  });
}

export function getTypeDistribution(params) {
  return request({
    url: '/server/policy-communications/analysis/type-distribution',
    method: 'get',
    params
  });
}

export function getWordCloud(params) {
  return request({
    url: '/server/policy-communications/analysis/word-cloud',
    method: 'get',
    params
  });
}

export function getDepartmentList(params) {
  return request({
    url: '/server/policy-communications/analysis/department-list',
    method: 'get',
    params
  });
}

export function exportOvertimeList(params) {
  return request({
    url: '/server/policy-communications/analysis/export-overtime',
    method: 'get',
    params,
    responseType: 'blob'
  });
}
