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

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

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

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

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

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

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

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

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

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