import request from '@/utils/request'
/** =========================user=======================**/
export function getUserList(param) {
  return request({
    url: '/user/getUserList',
    method: 'post',
    data: param
  })
}

export function getUserTypeList() {
  return request({
    url: `/UserTypeRole/getUserTypeList/0`,
    method: 'get'
  })
}

export function updateUserState(userId, state) {
  return request({
    url: `/user/updateUserState/${userId}/${state}`,
    method: 'post'
  })
}

export function getInstitutionList(typeId) {
  return request({
    url: `/institution/getInstitutionList/${typeId}`,
    method: 'get'
  })
}

export function addUser(param) {
  return request({
    url: `/user/addUser`,
    method: 'post',
    data: param
  })
}

export function updateUser(param) {
  return request({
    url: `/user/updateUser`,
    method: 'put',
    data: param
  })
}
export function updateUserBasicInfo(param) {
  return request({
    url: `/user/updateUserBasicInfo`,
    method: 'put',
    data: param
  })
}

export function getUser(params) {
  return request({
    url: `/user/getUser`,
    method: 'get',
    params
  })
}

export function deleteSysUser(userId) {
  return request({
    url: `/user/deleteUser/${userId}`,
    method: 'delete'
  })
}

export function getRoleList(userId, pageIndex, pageSize) {
  return request({
    url: `/role/getRoleList/${userId}/${pageIndex}/${pageSize}`,
    method: 'get'
  })
}

export function getUserRoles(userId) {
  return request({
    url: `/user/getUserRoles/${userId}`,
    method: 'get'
  })
}

export function UpdateUserRole(param) {
  return request({
    url: `/role/UpdateUserRole`,
    method: 'post',
    data: param
  })
}

export function resetPassword(data) {
  return request({
    url: `/user/resetPassword`,
    method: 'post',
    data
  })
}

export function modifyPassword(param) {
  return request({
    url: `/user/modifyPassword`,
    method: 'post',
    data: param
  })
}

/** =========================role=======================**/
export function getRolesList(pageIndex, pageSize) {
  return request({
    url: `/role/getRoleList/${pageIndex}/${pageSize}`,
    method: 'get'
  })
}

export function addOrUpdateRole(param) {
  return request({
    url: `/role/addOrUpdateRole`,
    method: 'post',
    data: param
  })
}

export function deleteRole(roleId) {
  return request({
    url: `/role/deleteRole/${roleId}`,
    method: 'delete'
  })
}

export function getRoleMenuFunction(roleId) {
  return request({
    url: `/menu/getRoleMenuFunction/${roleId}`,
    method: 'get'
  })
}

export function getRoleFunction(roleId, parentId) {
  return request({
    url: `/menu/getRoleFunction/${roleId}/${parentId}`,
    method: 'get'
  })
}

export function updateRoleMenu(param) {
  return request({
    url: `/menu/updateRoleMenu`,
    method: 'post',
    data: param
  })
}

export function updateRoleFunction(param) {
  return request({
    url: `/menu/updateRoleFunction`,
    method: 'post',
    data: param
  })
}
/** =========================menu=======================**/

export function getMenuFunction() {
  return request({
    url: `/menu/getMenuFunction`,
    method: 'get'
  })
}

export function addOrUpdateMenu(param) {
  return request({
    url: `/menu/addOrUpdateMenu`,
    method: 'post',
    data: param
  })
}

export function deleteMenuFunction(menuFunctionId) {
  return request({
    url: `/menu/deleteMenuFunction/${menuFunctionId}`,
    method: 'delete'
  })
}
/** =========================log=======================**/

export function getLogList(param) {
  return request({
    url: `/log/getLogList`,
    method: 'post',
    data: param
  })
}

/** =========================UserType=======================**/
export function getUserTypeRoleList(param) {
  return request({
    url: `/UserTypeRole/getUserTypeRoleList`,
    method: 'post',
    data: param
  })
}

export function addOrUpdateUserType(param) {
  return request({
    url: `/UserTypeRole/addOrUpdateUserTypeRole`,
    method: 'post',
    data: param
  })
}
export function deleteUserTypeRole(userTypeRoleId) {
  return request({
    url: `/UserTypeRole/deleteUserTypeRole/${userTypeRoleId}`,
    method: 'delete'
  })
}

export function getUserTypeListByUserType(userType) {
  return request({
    url: `/UserTypeRole/getUserTypeList/${userType}`,
    method: 'get'
  })
}

export function initSetUserNameAndPwd(params) {
  return request({
    url: `/User/initSetUserNameAndPwd?NewUserName=${params.NewUserName}&UserId=${params.UserId}&NewPwd=${params.NewPwd}&access_token=${params.access_token}`,
    method: 'get'
  })
}

export function getPublishLogList(param) {
  return request({
    url: `/PublishLog/getPublishLogList`,
    method: 'post',
    data: param
  })
}

export function addOrUpdatePublishLog(param) {
  return request({
    url: `/PublishLog/addOrUpdatePublishLog`,
    method: 'post',
    data: param
  })
}

export function deletePublishLog(publishLogId) {
  return request({
    url: `/PublishLog/deletePublishLog/${publishLogId}`,
    method: 'delete'
  })
}

export function getInternationalizationList(param) {
  return request({
    url: `/Internationalization/getInternationalizationList`,
    method: 'post',
    data: param
  })
}

export function getFrontInternationalizationList() {
  return request({
    url: `/Internationalization/getFrontInternationalizationList`,
    method: 'get'
  })
}
export function addOrUpdateInternationalization(param) {
  return request({
    url: `/Internationalization/addOrUpdateInternationalization`,
    method: 'post',
    data: param
  })
}

export function deleteInternationalization(internationalizationId) {
  return request({
    url: `/Internationalization/deleteInternationalization/${internationalizationId}`,
    method: 'delete'
  })
}

export function batchAddInternationalization(param) {
  return request({
    url: `/Internationalization/batchAddInternationalization`,
    method: 'post',
    data: param
  })
}

// 国际化获取迭代列表
export function getPublishVersionSelect() {
  return request({
    url: `/PublishLog/getPublishVersionSelect`,
    method: 'get',
  })
}
// 国际化批量更新
export function batchUpdateInternationalInfo(data) {
  return request({
    url: `/Internationalization/batchUpdateInternationalInfo`,
    method: 'put',
    data
  })
}
// 邮件事件消息列表
export function getEventStoreRecordList(data) {
  return request({
    url: `/EventStoreRecord/getEventStoreRecordList`,
    method: 'post',
    data
  })
}
// 重新发布事件消息
export function rePublishEvent(params) {
  return request({
    url: `/EventStoreRecord/rePublishEvent`,
    method: 'get',
    params
  })
}
// userId获取doctorId
export function useUserIDGetDoctorID(data) {
  return request({
    url: `/TrialSiteSurvey/useUserIDGetDoctorID`,
    method: 'post',
    data
  })
}

// 管理端修改用户角色
export function updateUserRoleInfo(data) {
  return request({
    url: `/User/updateUserRoleInfo`,
    method: 'put',
    data
  })
}
// 管理端新增用户发送邮件
export function addNewUserSendEmail(data) {
  return request({
    url: `/User/addNewUserSendEmail`,
    method: 'post',
    data
  })
}
// 用户追溯
export function getUserJoinedTrialList(data) {
  return request({
    url: `/TrialMaintenance/getUserJoinedTrialList`,
    method: 'post',
    data
  })
}
// 邮件日志-日志列表
export function getEmailLogList(data) {
  return request({
    url: `/EmailLog/getEmailLogList`,
    method: 'post',
    data
  })
}
// 邮件日志-日志详情
export function getEmailInfo(data) {
  return request({
    url: `/EmailLog/getEmailInfo`,
    method: 'post',
    data
  })
}
// 邮件日志-重发邮件
export function resendEmail(data) {
  return request({
    url: `/EmailLog/resendEmail`,
    method: 'post',
    data
  })
}
// 邮件日志-同步邮件
export function synchronizationEmail(data) {
  return request({
    url: `/EmailLog/synchronizationEmail`,
    method: 'post',
    data
  })
}
// 邮件日志-重发列表
export function getReSendEmail(data) {
  return request({
    url: `/EmailLog/getReSendEmail`,
    method: 'post',
    data
  })
}

// 获取系统基础配置
export function getSystemBasicConfigInfo() {
  return request({
    url: `/DeployConfig/getSystemBasicConfigInfo`,
    method: 'get',
  })
}
// 更新系统基础配置
export function updateSystemBasicConfig(data) {
  return request({
    url: `/DeployConfig/updateSystemBasicConfig`,
    method: 'post',
    data
  })
}
// 获取系统邮件配置
export function getEmailConfigInfo() {
  return request({
    url: `/DeployConfig/getEmailConfigInfo`,
    method: 'get',
  })
}
// 更新系统邮件配置
export function updateSystemEmailConfig(data) {
  return request({
    url: `/DeployConfig/updateSystemEmailConfig`,
    method: 'post',
    data
  })
}
// 获取前端配置
export function getWebConfigInfo() {
  return request({
    url: `/DeployConfig/getWebConfigInfo`,
    method: 'get'
  })
}
// 更新前端配置
export function updateWebConfigInfo(data) {
  return request({
    url: `/DeployConfig/updateWebConfigInfo`,
    method: 'put',
    data
  })
}

