import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data,
    ENCRYPT: true
  })
}
export function loginOut(params) {
  return request({
    url: `/User/loginOut`,
    method: 'get',
    params
  })
}
export function getAllDictionary() {
  return request({
    url: '/dictionary/getAllDictionary',
    method: 'get'
  })
}

export function getHospitalList() {
  return request({
    url: '/hospital/hospitalList',
    method: 'get'
  })
}

export function sendVerificationCode(emailOrPhone) {
  return request({
    url: `/user/sendVerificationCode/${emailOrPhone}`,
    method: 'get'
  })
}
export function anonymousSendVerificationCode(emailOrPhone) {
  return request({
    url: `/user/anonymousSendVerificationCode/${emailOrPhone}`,
    method: 'get'
  })
}

export function verifyAnonymousVerifyCode(email, verifyCode) {
  return request({
    url: `/User/verifyAnonymousVerifyCode/${email}/${verifyCode}`,
    method: 'get'
  })
}

export function anonymousSetPassword(userId, newPwd) {
  return request({
    url: `/User/anonymousSetPassword/${userId}/${newPwd}`,
    method: 'get'
  })
}
export function setNewPassword(param) {
  return request({
    url: `/user/setNewPassword`,
    method: 'post',
    data: param
  })
}

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

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

export function getDoctorShortcutKey(params) {
  return request({
    url: `/ShortcutKey/getDoctorShortcutKey`,
    method: 'post',
    data: params
  })
}

export function setShortcutKey(params) {
  return request({
    url: `/ShortcutKey/setShortcutKey`,
    method: 'post',
    data: params
  })
}

export function restoreDefaultShortcutKey(params) {
  return request({
    url: `/ShortcutKey/restoreDefaultShortcutKey`,
    method: 'post',
    data: params
  })
}

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

export function addOrUpdateUserWLTemplate(params) {
  return request({
    url: `/UserWLTemplate/addOrUpdateUserWLTemplate`,
    method: 'post',
    data: params
  })
}

export function deleteUserWLTemplate(userWLTemplateId) {
  return request({
    url: `/UserWLTemplate/deleteUserWLTemplate/${userWLTemplateId}`,
    method: 'delete'
  })
}

export function getAutoCutNextTask(params) {
  return request({
    url: `/UserWLTemplate/getAutoCutNextTask`,
    method: 'post',
    data: params
  })
}
export function setAutoCutNextTask(params) {
  return request({
    url: `/UserWLTemplate/setAutoCutNextTask`,
    method: 'post',
    data: params
  })
}

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

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

export function getUserLogList(params) {
  return request({
    url: `/User/getUserLogList`,
    method: 'post',
    data: params
  })
}

// 获取登录用户
export function getTrialUserList(params) {
  return request({
    url: `/TrialMaintenance/getTrialUserList`,
    method: 'get',
    params
  })
}

// 验证MFA邮件
export function verifyMFACode(params) {
  return request({
    url: `/User/verifyMFACode`,
    method: 'post',
    params
  })
}

// 发送MFA邮件
export function sendMFAEmail(data) {
  return request({
    url: `/User/sendMFAEmail`,
    method: 'post',
    data
  })
}
// 获取公钥
export function getPublicKey() {
  return request({
    url: `/user/getPublicKey`,
    method: 'get',
  })
}
// 登陆获取角色
export function getUserLoginRoleList(data) {
  return request({
    url: `/User/getUserLoginRoleList`,
    method: 'post',
    data,
  })
}
// 登陆角色id获取token
export function loginSelectUserRole(params) {
  return request({
    url: `/User/loginSelectUserRole`,
    method: 'get',
    params,
  })
}
// 忽略异地登录
export function setIsIgnoreUncommonly(data) {
  return request({
    url: `/User/setIsIgnoreUncommonly`,
    method: 'post',
    data,
  })
}
