import http from '@/utils/http'

export function login(account, password, codeKey, code) {
  return http.post('/sys-user/login', {account, password, codeKey, code})
}

export function getInfo() {
  return http.get('/sys-user/login-info')
}

export function getUserPage(query) {
  return http.post('/sys-user/page', query)
}

export function getUserById(userId) {
  return http.get(`/sys-user/${userId}`)
}

export function addOuterUser(user) {
  return http.post(`/sys-user/outer`, user)
}

export function editOuterUser(user, userId) {
  return http.put(`/sys-user/outer/${userId}`, user)
}

export function assignRoles(params) {
  return http.post('/sys-user/assign-roles', params)
}

export function deleteUser({userId}) {
  return http.delete(`/sys-user/${userId}`)
}

export function changePassword(values) {
  return http.put(`/user/change-password`, values)
}

export function getDetailInfo() {
  return http.get('/user/detail')
}

export function logout() {
  return http.post('/sys-user/logout')
}

export function addAdminApi(body) {
  return http.post('/user/admin/add', body)
}

export function initWxUserApi() {
  return http.post('/user/init-wx')
}

export function qyWxLoginApi(code) {
  return http.post(`/user/qy-wx-login?code=${code}`)
}

//待选择标注人员
export function getMarkPersonList(projectId) {
  return http.get(`/sys-user/mark-person-list?projectId=` + projectId)
}

//新增内部用户
export function addInnerUser(addForm) {
  return http.post('/sys-user/inner', addForm)
}

//编辑内部用户
export function editInnerUser(editForm, userId) {
  return http.put('/sys-user/inner/' + userId, editForm)
}

//根据账号查询内部用户信息
export function getInnerUserInfo(account) {
  return http.get('/sys-user/inner/user-info?account=' + account)
}

//内部员工登录
export function innerLogin() {
  return http.post('/sys-user/inner-login')
}
