/**
 * 证书报告接口
*/
import request from '../../index'
import type { IListQuery } from '@/views/business/lab/reportOnCredentials/report_interface'
const prefix = '/business/certificateReport'

// 列表查询
export function getReportList(data: IListQuery) {
  return request({
    url: `${prefix}/approval/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 导出列表
export function exportReportList(data: Omit<IListQuery, 'limit' | 'offset'>) {
  return request({
    url: `${prefix}/listExport`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 删除
export function deleteReportList(data: { id: string }) {
  return request({
    url: `${prefix}/batchDelete`,
    method: 'post',
    data,
  })
}

// 提交
export function submitReportList(data: { id: string; formId: string }) {
  return request({
    url: `${prefix}/submit`,
    method: 'post',
    data,
  })
}

// 新建
export function addReport(data: any) {
  return request({
    url: `${prefix}/save`,
    method: 'post',
    data,
  })
}

// 编辑--草稿箱
export function draftUpdateReport(data: any) {
  return request({
    url: `${prefix}/draftUpdate`,
    method: 'post',
    data,
  })
}

// 编辑--未通过-驳回
export function failUpdateReport(data: any) {
  return request({
    url: `${prefix}/failUpdate`,
    method: 'post',
    data,
  })
}
// 培训计划保存后的提交
export function submitReport(data: object) {
  return request({
    url: `${prefix}/submit`,
    method: 'post',
    data,
  })
}

// 获取详情
export function getReportDetail(data: { id: string }) {
  return request({
    url: `${prefix}/detail`,
    method: 'post',
    data,
  })
}

// 草稿箱删除
export function draftDeleteReport(data: { ids: Array<string> }) {
  return request({
    url: `${prefix}/batchDelete`,
    method: 'post',
    data,
  })
}

// 审批删除
export function approvalDeleteReport(data: { id: string; taskId: string }) {
  return request({
    url: `${prefix}/approval/operate/delete`,
    method: 'post',
    data: [data],
  })
}
