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

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

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

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

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

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

// 未通过提交（重走流程审批）
export function failUpdateChangeForm(data: object) {
  return request({
    url: `${prefix}/change/failUpdate`,
    method: 'post',
    data,
  })
}

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

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

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

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