import { fetch, post, ApiResponse } from './index'

export function fetchDigitCaptcha(params = {}): Promise<ApiResponse<Record<string, string>>> {
  return fetch({ url: '/upms/login/digit-captcha', params })
}

export function sendLoginSmsCode(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/login/sms-code', params })
}

export function loginByPwd(params = {}): Promise<ApiResponse<{
  token: string
  urlPrefix: string
  permissionCodes: string[]
  ttl: number
}>> {
  return post({ url: '/upms/login/admin-token', params })
}

export function removeAttachment(params = {}, headers = {}): Promise<ApiResponse<any>> {
  return post({ url: '/recruit-common/attachment/remove', params, headers })
}

export function updateUserPwdNoAuth(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/recruit-upms/auth/update-pwd-no-auth', params })
}

export function fetchMultiAccount(params = {}): Promise<ApiResponse<any[]>> {
  return fetch({ url: '/recruit-upms/auth/multi-account', params })
}
