import request from '@/utils/request'

// 查询所有租户外呼通话记录列表
export function listAllCallRecords(query) {
  return request({
    url: '/admin/callRecord/list',
    method: 'get',
    params: query
  })
}

// 根据租户ID查询外呼记录
export function listByCompany(companyId) {
  return request({
    url: '/admin/callRecord/byCompany/' + companyId,
    method: 'get'
  })
}

// 获取外呼记录详情
export function getCallRecordInfo(logId) {
  return request({
    url: '/admin/callRecord/' + logId,
    method: 'get'
  })
}

// 获取通话录音
export function getCallAudio(logId) {
  return request({
    url: '/admin/callRecord/audio/' + logId,
    method: 'get'
  })
}

// 查询质检记录列表
export function listQualityRecords(query) {
  return request({
    url: '/admin/callRecord/quality/list',
    method: 'get',
    params: query
  })
}

// 获取质检记录详情
export function getQualityRecord(id) {
  return request({
    url: '/admin/callRecord/quality/' + id,
    method: 'get'
  })
}

// 新增质检记录
export function addQualityRecord(data) {
  return request({
    url: '/admin/callRecord/quality',
    method: 'post',
    data: data
  })
}

// 修改质检记录
export function updateQualityRecord(data) {
  return request({
    url: '/admin/callRecord/quality',
    method: 'put',
    data: data
  })
}

// 删除质检记录
export function deleteQualityRecord(id) {
  return request({
    url: '/admin/callRecord/quality/' + id,
    method: 'delete'
  })
}

// 报备质检
export function reportQuality(logIds) {
  return request({
    url: '/admin/callRecord/report',
    method: 'post',
    data: logIds
  })
}

// 获取通话统计信息
export function getCallStatistics() {
  return request({
    url: '/admin/callRecord/statistics',
    method: 'get'
  })
}

// 导出通话记录
export function exportCallRecord(query) {
  return request({
    url: '/admin/callRecord/export',
    method: 'get',
    params: query
  })
}