import { get, post } from '@/api/request';

const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_CAPABILITY;

/**
 * 创建流程草稿模板
 * @param
 * @returns
 */
export const addFlowTemplateDraftApi = (params: any) => {
  return post(`${PREFIX}flow/createFlowTemplateDraft`, params);
};

/**
 * 升版流程草稿模板
 * @param
 * @returns
 */
export const upgradeFlowTemplateDraftApi = (params: any) => {
  return post(`${PREFIX}flow/upgradeFlowTemplateDraft`, params);
};

/**
 *
 * @param params
 * @param templateStatus 流程模版状态 0：禁用 1：启用
 * @param approveType 流程模版审批状态 0：未审批 1：审批中 2：审批通过 3：审批未通过
 * @returns
 */
export const updateFlowTemplateDraftApi = (params: any) => {
  return post(`${PREFIX}flow/updateFlowTemplateDraft`, params);
};

export const deleteFlowTemplateDraftApi = (params: any) => {
  return post(`${PREFIX}flow/deleteFlowTemplateDraft`, params);
};

export const releaseFlowTemplateApi = (params: any) => {
  return post(`${PREFIX}flow/releaseFlowTemplate`, params);
};

/**
 *
 * @param params
 * @param type 1 通用模板库 2 个人模板库
 * @returns
 */
export const queryFlowTemplateApi = (params: any) => {
  return post(`${PREFIX}flow/queryFlowTemplate`, params);
};

/**
 *
 * @param params type  0 uuid  1 code
 * @returns
 */
export const queryFlowTemplateVersionApi = (params: any) => {
  return get(`${PREFIX}flow/queryFlowTemplateVersion`, params);
};
/**
 *
 * @param status 流程模版状态 0：禁用 1：启用
 * @returns
 */
export const queryFlowTemplateDetailApi = (params: any) => {
  return get(`${PREFIX}flow/queryFlowTemplateInfo`, params);
};

/**
 *
 * @param status 流程模版状态 0：禁用 1：启用
 * @returns
 */
export const updateFlowTemplateUseStatusApi = (params: any) => {
  return get(`${PREFIX}flow/setFlowTemplateStatus`, params);
};

