import { WeaTools } from 'ecCom';


// 流程接口注册高级搜索
export const getInterfaceRegisterCondition = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCondition', 'POST', params);
};

// 流程接口部署高级搜索
export const getInterfaceDeploymentCondition = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentCondition', 'POST', params);
};

// 右键菜单
export const getRightMenus = (params,param) => {
    let api = "/api/integration/workflowflow/getInterfaceDeploymentRightMenu";
    if(params===0) {
        api = "/api/integration/workflowflow/getInterfaceRegisterRightMenu";
    }
    return WeaTools.callApi(api, 'POST', param);
};

// 流程接口注册列表
export const getInterfaceRegisterList = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterList', 'POST', params);
}
// 流程接口部署列表
export const getInterfaceDeploymentList = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentList', 'POST', params);
}


// 流程接口注册DML表单
export const getInterfaceRegisterDMLAddForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLAddForm', 'POST', params);
}
export const getInterfaceRegisterDMLEditForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLEditForm', 'POST', params);
}
// 流程接口注册Webservice表单
export const getInterfaceRegisterWebserviceAddForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterWebserviceAddForm', 'POST', params);
}
export const getInterfaceRegisterWebserviceOperation = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterWebserviceOperation', 'POST', params);
}

//注册ESB表单
export const getInterfaceRegisterESBAddForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterESBAddForm', 'POST', params);
}

//根据ESB服务id和version获取对应的分页列表数据
export const getESBPublishParam = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getESBPublishParam', 'POST', params);
}

//根据传入的esbid和版本以及actionid获取规则数据
export const getESBReturnContralDatas = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getESBReturnContralData', 'POST', params);
}

//根据传入的规则id删除ESB返回控制规则
export const deleteESBReturnContralData = params => {
    return WeaTools.callApi('/api/integration/workflowflow/deleteESBReturnContralData', 'POST', params);
}

//ESB接口增删改提交动作处理
export const getInterfaceRegisterESBOperation = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterESBOperation', 'POST', params);
}

//根据参数获取对应的下拉选项ESB
export const getlinkageSelectForESB = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getlinkageSelectForESB', 'POST', params);
}

// 注册DML接口增删改提交动作处理
export const getInterfaceRegisterDMLOperation = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLOperation', 'POST', params);
}

export const getInterfaceRegisterCustomOperation = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomOperation', 'POST', params);
}
export const getInterfaceDeploymentOperation = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentOperation', 'POST', params);
}
export const getInterfaceRegisterCustomAddForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomAddForm', 'POST', params);
}
export const getInterfaceRegisterCustomAddFormOnline = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomAddFormOnline', 'POST', params);
}
export const getInterfaceRegisterRunLogList = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterRunLogList', 'POST', params);
}
export const getInterfaceRegisterRunLogCondition = params => {
  return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterRunLogCondition', 'POST', params);
}
export const getInterfaceDeploymentAddForm = params => {
    return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentAddForm', 'POST', params);
}

export const getDataShowOperation = params => {
    return WeaTools.callApi('/api/integration/datashow/getDataShowOperation', 'POST', params);
};


// ESB

export const getESBRightMenu = params => {
  return WeaTools.callApi('/api/integration/esbaction/base/getFQRightMenu', 'GET', params);
}

export const getESBFields = params => {
  return WeaTools.callApi('/api/integration/esbaction/base/getFields', 'GET', params);
}

export const getESBRequestDatas = params => {
  return WeaTools.callApi('/api/integration/esbaction/getEventRequestData', 'GET', params);
}

export const getESBDetailFields = params => {
  return WeaTools.callApi('/api/integration/esbaction/base/getDetailFields', 'GET', params);
}

export const getSelectData = params => {
  return WeaTools.callApi('/api/integration/esbaction/getSelectData', 'GET', params);
}

export const getWorkflowMainFields = params => {
  return WeaTools.callApi('/api/integration/esbaction/base/getMainFields', 'GET', params);
}

export const saveAction = params => {
  return WeaTools.callApi('/api/integration/esbaction/saveAction', 'POST', params);
}

export const delectAction = params => {
  return WeaTools.callApi('/api/integration/esbaction/deleteAction', 'POST', params);
}

export const checkEsbService = params => {
  return WeaTools.callApi('/api/integration/esbaction/checkEsbService', 'GET', params);
}

//获取测试结果信息
export const getBase = (type,testId) => {
    return WeaTools.callApi(`/api/integration/workflowaction/test/${type}/${testId}`, 'GET');
};

//获取预览信息
export const getPreview = (type,testId) => {
    return WeaTools.callApi(`/api/integration/workflowaction/test/preview/${type}/${testId}`, 'GET');
};

//获取基础信息维护控件
export const getFields = (apiUrl, params) => {
    return WeaTools.callApi(apiUrl + '/getFields', 'GET', params);
};
//获取右键菜单
export const getRightMenu = (apiUrl, params) => {
    return WeaTools.callApi(apiUrl + '/getRightMenu', 'GET', params);
};


//获取右键菜单
export const getRightMenu2 = (apiUrl, params) => {
    return WeaTools.callApi(apiUrl + '/getRightMenu2', 'GET', params);
};

//保存表单参数
export const saveParam =(params,type,testId)=>{
    return WeaTools.callApi(`/api/integration/workflowaction/test/saveParam/${type}/${testId}`, 'POST', params);
};

//检测表单参数
export const checkHasParam=(type,testId)=>{
    return WeaTools.callApi(`/api/integration/workflowaction/test/checkHasParam/${type}/${testId}`, 'POST');
};

// 建模对接
export const getFormModuleField = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getFields', 'GET', params);
export const getFormModuleMainFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getMainFields', 'GET', params);
export const getFormModuleSelectData = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getSelectData', 'GET', params);
export const getFormModuleDetailFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getDetailFields', 'GET', params);
export const getFormModuleFunFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getFunFields', 'GET', params);
export const getFormModuleSave = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/saveAction', 'POST', params);
export const getFormModuleAutoMappingFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/automapping/getFields', 'GET', params);
export const getFormModuleAutoMapping = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getTableFields', 'GET', params);
export const getFormModuleRequestDatas = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getEventRequestData', 'GET', params);
// 字段联动
export const getFormModuleFieldInfo = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getFields', 'GET', params);
export const getFormModuleFieldSelectData = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getSelectData', 'GET', params);
export const getFormModuleFieldMainFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getMainFields', 'GET', params);
export const getFormModuleFieldDetailFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getDetailFields', 'GET', params);
export const getFormModuleFieldSave = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/saveAction', 'POST', params);
export const getFormModuleFieldRequestDatas = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getEventRequestData', 'GET', params);
export const getFormModuleFieldAutoMapping = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getTableFields', 'GET', params);
