
// WFProcess 流程模版基本信息 
import { defHttp } from '@/utils/http/axios';
import {CreateParams,DeleteDraftParams,RevokeAuditParams} from './model/WFProcessModel'
import {MyUncompletedParams} from './model/WFTaskModel'

  enum Api {
  // 创建流程
  Create = '/api/WFProcess/Create',
  // 保存草稿
  SaveDraft='/api/WFProcess/SaveDraft',
  // 我的流程
  LoadMyPage='/api/WFProcess/LoadMyPage',
  // 我的草稿
  LoadMyDraftPage='/api/WFProcess/LoadMyDraftPage',
  // 删除草稿
  DeleteDraft='/api/WFProcess/DeleteDraft',
  // 催办
  Urge='/api/WFProcess/Urge',
  // 撤销
  Revoke='/api/WFProcess/Revoke',
  // 审核撤销
  RevokeAudit='/api/WFProcess/RevokeAudit',
  // 获取流程图详情
  GetBPMN='/api/WFProcess/GetBPMN'
 
}

/**
 * @description: 创建流程
 */
export function create( params?:CreateParams) {
  return defHttp.post(
    {
      url: Api.Create,
      params,
    },
  );
}
/**
 * @description: 保存草稿
 */
 export function saveDraft( params?:CreateParams) {
  return defHttp.post(
    {
      url: Api.SaveDraft,
      params,
    },
  );
}
/**
 * @description: getLoadMyPage
 */
 export function getLoadMyPage(params?: MyUncompletedParams) {
  return defHttp.get({ url: Api.LoadMyPage, params });
}
/**
 * @description: getLoadMyDraftPage
 */
 export function getLoadMyDraftPage(params?: MyUncompletedParams) {
  return defHttp.get({ url: Api.LoadMyDraftPage, params });
}
/**
 * @description: 删除草稿
 */
 export function deleteDraft( params:DeleteDraftParams) {
  return defHttp.post(
    {
      url: Api.DeleteDraft+"?id="+params.id,
      params,
    },
  );
}
/**
 * @description: 催办
 */
 export function urge( params:DeleteDraftParams) {
  return defHttp.post(
    {
      url: Api.Urge+"?id="+params.id,
      params,
    },
  );
}
/**
 * @description: 撤销
 */
 export function revoke( params:DeleteDraftParams) {
  return defHttp.post(
    {
      url: Api.Revoke+"?id="+params.id,
      params,
    },
  );
}
/**
 * @description: 审核撤销
 */
 export function revokeAudit(params:RevokeAuditParams) {
  return defHttp.post(
    {
      url: Api.RevokeAudit+"?id="+params.id+"&taskId="+params.taskId,
      params,
    },
  );
}
/**
 * @description: getPBMN
 */
 export function getBPMN(params?: DeleteDraftParams) {
  return defHttp.get({ url: Api.GetBPMN, params });
}