import {WeaTools} from 'ecCom';

//保存LDAP基础信息，type=add添加，type=edit修改
export const saveBase = (type,params) => {
    return WeaTools.callApi('/api/integration/ldap/' + type, 'POST', params);
};

//删除LDAP信息
export const deleteLdap = (params) => {
    return WeaTools.callApi('/api/integration/ldap/delete', 'POST', params);
};

//配置定时任务
export const configSchedule = (params) => {
    return WeaTools.callApi("/api/integration/ldap/schedule", 'POST', params);
};

//配置同步节点及映射信息
export const configSync = (ldapId, type, params) => {
    let url = ldapId + '/' + type;
    return WeaTools.callApi('/api/integration/ldap/config/' + url + '/sync', 'POST', params);
};

//配置映射关系
export const configMapping = (ldapId,type,params) => {
    let url = ldapId + '/' + type;
    return WeaTools.callApi('/api/integration/ldap/config/' + url + '/mapping', 'POST', params);
};

//获取模板信息
export const getTemplate = (type) => {
    return WeaTools.callApi('/api/integration/ldap/template/' + type, 'GET', {});
};

//获取数据转换方法信息
export const getFormart = (type) => {
    return WeaTools.callApi('/api/integration/ldap/formart/' + type, 'GET', {});
};

//执行同步
export const runSync = (ldapId,type,params) => {
    let url = type + '/' + ldapId;
    return WeaTools.callApi('/api/integration/ldap/' + url, 'POST',params);
};

//查看同步日志
export const showSyncLog = (ldapId,params) =>{
    return WeaTools.callApi('/api/integration/ldap/synclog/' + ldapId, 'GET',params);
}

export const getBase = (ldapId, type) => {
    return WeaTools.callApi(`/api/integration/ldap/test/${ldapId}/${type}`, '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);
};

//删除LDAP自定义接口信息
export const deleteCustomInterface = (params) => {
    return WeaTools.callApi('/api/integration/ldap/deleteCustomInterface', 'POST', params);
};

//保存LDAP自定义接口基础信息，type=addCustomInterface添加，type=editCustomInterface修改
export const saveCustomInterfaceBase = (type,params) => {
    return WeaTools.callApi('/api/integration/ldap/' + type, 'POST', params);
};

//删除LDAP同步日志接口信息
export const deleteLdapSyncLog = (params) => {
    return WeaTools.callApi('/api/integration/ldap/deleteSyncLogs', 'POST', params);
};

// 指定部门确定接口
export const updateUserInfo = (params) => {
    return WeaTools.callApi('/api/integration/ldap/updateUserInfo', 'POST', params);
}

// 合并用户确定接口
export const mergeUserInfo = (params) => {
    return WeaTools.callApi('/api/integration/ldap/mergeUserInfo', 'POST', params);
}

// 批量合并点击测试
export const getTestMatchData = (params) => {
    return WeaTools.callApi('/api/integration/ldap/getTestMatchData', 'POST', params);
}

// 批量合并点击合并
export const batchMergeUserInfo = (params) => {
    return WeaTools.callApi('/api/integration/ldap/batchMergeUserInfo', 'POST', params);
}