import request from '../index'
const prefix = 'resource/customer'

export function getExamineList(data: any) {
  return request({
    url: `${prefix}/examine/approval/listPage?limit=${data.limit}&offset=${data.offset}`,
    method: 'post',
    data,
  })
}

// 保存 草稿箱
export function saveExamine(data: object) {
  return request({
    url: `${prefix}/examine/save`,
    method: 'post',
    data,
  })
}

// 删除 草稿箱
export function deleteExamineDraft(data: object) {
  return request({
    url: `${prefix}/examine/draftDelete`,
    method: 'post',
    data,
  })
}

// 删除 已取消
export function deleteExamineRevoked(data: object) {
  return request({
    url: `${prefix}/examine/approval/delete`,
    method: 'post',
    data,
  })
}

// 提交流程
export function submitExamine(data: object) {
  return request({
    url: `${prefix}/examine/submit`,
    method: 'post',
    data,
  })
}

// 发起者撤回，表单状态更改为已取消
export function revokeApproval(data: object) {
  return request({
    url: `${prefix}/examine/approval/revoke`,
    method: 'post',
    data,
  })
}

// 委托方名录审批-拒绝
export function refuseApproval(data: object) {
  return request({
    url: `${prefix}/examine/approval/refuse`,
    method: 'post',
    data,
  })
}

// 草稿箱编辑（不走流程审批）
export function updateDraftExamine(data: object) {
  return request({
    url: `${prefix}/examine/draftUpdate`,
    method: 'post',
    data,
  })
}

// 未通过委托方编辑（重走流程审批）
export function failUpdateExamine(data: object) {
  return request({
    url: `${prefix}/examine/failUpdate`,
    method: 'post',
    data,
  })
}

export function sendTo(data: object) {
  return request({
    url: `${prefix}/examine/sendTo`,
    method: 'post',
    data,
  })
}
