// WFSchemeInfo 流程模版基本信息 
import { defHttp } from '@/utils/http/axios';
import {SchemeListParams,GetSchemeModel,AddParams,
  DeleteParams,UpdateParams,StateParams,HistoryParams,GetHistoryModel,SchemeParams,DetailParams} from './model/wfSchemeInfoModel'

  enum Api {
  // 流程模板基本信息
  LoadPage = '/api/WFSchemeInfo/LoadPage',
  Add = '/api/WFSchemeInfo/Add',
  Update = '/api/WFSchemeInfo/Update',
  Delete = '/api/WFSchemeInfo/Delete',
  UpDateState = '/api/WFSchemeInfo/UpDateState',
  GetDetail='/api/WFSchemeInfo/Get',
  // 可用模板合集
  Load='/api/WFSchemeInfo/Load',
  // 流程模板详细信息
  LoadHistoryPage= '/api/WFScheme/LoadPage',
  UpdateScheme='/api/WFSchemeInfo/UpdateScheme',
  // 获取某模板历史数据
  VerisonsLoad='/api/WFScheme/Load',
  // 获取自定义流程列表（流程发起页）
  GetInfoList='/api/WFSchemeInfo/GetInfoList'
}

/**
 * @description: getLoadPage 模板列表
 */
export function getLoadPage(params?: SchemeListParams) {
  return defHttp.get<GetSchemeModel>({ url: Api.LoadPage, params });
}
export function getDetail(params?: DetailParams){
  return defHttp.get({ url: Api.GetDetail, params });
}
/**
 * @description: getLoad 可用模板列表
 */
 export function getLoad(params?: SchemeListParams) {
  return defHttp.get<GetSchemeModel>({ url: Api.Load, params });
}
/**
 * @description: postAdd
 */
export function postAdd( params?:AddParams) {
  return defHttp.post(
    {
      url: Api.Add,
      params,
    },
  );
}

export function update(params:UpdateParams) {
  return defHttp.post({
    url: Api.Update+"?id="+params.schemeinfo.id,
    params
  });
}

export function del(params:DeleteParams) {
  return defHttp.post({ url: Api.Delete + "?id=" + params.id });
}

export function updateState(params:StateParams){
  return defHttp.post({ url: Api.UpDateState + "?id=" + params.id +"&state="+params.state});
}

export function getLoadHistoryPage(params?:HistoryParams){
  return defHttp.get<GetHistoryModel>({url:Api.LoadHistoryPage,params})
}
export function getVerisonsLoad(params?:HistoryParams){
  return defHttp.get<GetHistoryModel>({url:Api.VerisonsLoad,params})
}

export function updateScheme(params:SchemeParams){
  return defHttp.post({ url: Api.UpdateScheme + "?id=" + params.id +"&schemeId="+params.schemeId});
}

/**
 * @description: getInfoList 获取流程自定义列表
 */
 export function getInfoList(params) {
  return defHttp.get({ url: Api.GetInfoList, params });
}

