// 审批接口
import request from './index'
const approvalType: { [key: string]: string } = {
  agree: '/approval/operate/agree',
  refuse: '/approval/operate/refuse',
  reject: '/approval/operate/reject',
}
// 审批操作接口
export function submitApproval(type: string, data: { processId?: string; taskId?: string; comments: string }) {
  return request({
    url: approvalType[type],
    method: 'post',
    data,
  })
}

// 取消审批--(通用接口、本项目不用)
export function cancelApproval(data: { processInstanceId?: string; comments: string }) {
  return request({
    url: '/approval/operate/revoke',
    method: 'post',
    data,
  })
}
// 查询审批记录
export function fetchApproval(processId: string) {
  return request({
    url: '/approval/operate/approvalLog',
    method: 'get',
    params: { processId },
  })
}
