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

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

/**
 * 流程节点继续执行（完成人工节点/或者等待用户输入后继续手动执行的节点）
 * @param params processInstanceId 流程实例ID taskDefinitionKey 流程节点id  flowelementType userTask - 普通用户任务 serviceTask - ServiceTask前置隐藏等待任务
 * @returns
 */
export const continueServiceTaskApi = (params: any) => {
  return post(`${PREFIX}process/continueServiceTask`, params);
};

/**
 * 预览节点输入文件列表
 * @param params processDefinitionId runId nodeId beforeNodeId regexConfig(masterFileRegularStr,inputFilesRegularStr)
 * @returns
 */
export const previewNodeInputFilesApi = (params: any) => {
  return post(`${PREFIX}process/previewNodeInputFiles`, params);
};

/**
 * 改变任务执行的节点的控制状态
 * @param params processDefinitionId  nodeId runId someBizParam executeMode
 * @returns
 */
export const saveParamsByDefinitionIdApi = (params: any) => {
  return post(`${PREFIX}process/saveParamsByDefinitionId`, params);
};

/**
 * 异步任务回调接口，用于唤醒等待的流程实例
 * @param params asyncTaskId resultJson status
 * @returns
 */
export const asyncCallbackApi = (params: any) => {
  return post(`${PREFIX}process/asyncCallback`, params);
};
