import request from '@/config/axios'

// 获取人才信息
export const getBaseInfo = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/person/get',
    params
  })
}

// 发送验证码
export const sendSmsCode = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/auth/send-sms-code',
    data
  })
}

// 验证码登录
export const smsLogin = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/auth/sms-login',
    data
  })
}

// 切换登录
export const switchLoginOfEnterprise = async (data) => {
  return await request.post({
    url: '/app-admin-api/menduner/system/enterprise/auth/switch-login',
    data
  })
}

// 企业-验证码登录
export const smsLoginOfEnterprise = async (data) => {
  return await request.post({
    url: '/app-admin-api/menduner/system/enterprise/auth/sms-login',
    data
  })
}

// 企业-密码登录
export const passwordLoginOfEnterprise = async (data) => {
  return await request.post({
    url: '/app-admin-api/menduner/system/enterprise/auth/login',
    data
  })
}


// 密码登录
export const passwordLogin = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/auth/login',
    data
  })
}

// 退出登录
export const logout = async () => {
  return await request.post({
    url: '/app-api/menduner/system/auth/logout'
  })
}

// 根据令牌退出登录
export const logoutToken = async (token) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/enterprise/auth/logout-token?token=${token}`
  })
}


// 修改密码
export const updatePassword = async (data) => {
  return await request.put({
    url: '/app-api/menduner/system/mde-user/update-password',
    data
  })
}

// 重置密码
export const resetPassword = async (data) => {
  return await request.post({
    url: '/admin-api/menduner/system/mde-user/update-password',
    data
  })
}

// 字典
export const getDictData = async (params) => {
  return await request.get({
    url: '/app-api/system/dict-data/type',
    params
  })
}

// 点击访问职位埋点
export const getPositionTreeClick = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/position/click',
    data
  })
}

// 获取职位列表
export const getPositionData = async (params) => {
  return request.get({
    url: '/app-api/menduner/system/position/list',
    params
  })
}

// 获取热门职位
export const getHotPositionList = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/position/hot',
    params
  })
}

// 获得职位信息
export const getPositionTreeData = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/position/get/tree',
    params
  })
}

// 获取区域树形
export const getAreaTreeData = async () => {
  return await request.get({
    url: '/app-api/menduner/system/area/get/tree'
  })
}

// 获取行业树形
export const getIndustryTreeData = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/industry/get/tree',
    params
  })
}

// 获取行业列表
export const getIndustryListData = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/industry/list',
    params
  })
}

// 获取地区列表
export const getAreaListData = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/area/list',
    params
  })
}

// 获取-技能列表
export const getSkillList = async () => {
  return await request.get({
    url: '/app-api/menduner/system/skill/list'
  })
}

// 获取地区获取地区map
export const getAreaMapData = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/area/map',
    params
  })
}

// 公司检索-获取热门地区
export const getHotArea = async () => {
  return await request.get({
    url: '/app-api/menduner/system/area/get/hot'
  })
}

// 上传文件
export const uploadFile = async (data) => {
  return await request.upload({ url: '/app-api/infra/file/upload', data })
}

// 获取当前登录的企业用户信息
export const getEnterprisingUserInfo = async (params) => {
  return await request.get({
    url: '/app-admin-api/menduner/system/user/get',
    params
  })
}

// 招聘端-刷新令牌token
export const enterpriseRefreshToken = async (refreshToken) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/enterprise/auth/refresh-token?refreshToken=${refreshToken}`
  })
}

// 求职端-刷新令牌token
export const userRefreshToken = async (refreshToken) => {
  return await request.post({
    url: `/app-api/menduner/system/auth/refresh-token?refreshToken=${refreshToken}`
  })
}

// 招聘端-企业账户信息（积分&余额）
export const getEnterpriseUserAccount = async () => {
  return await request.get({
    url: '/app-admin-api/menduner/system/user/get/account'
  })
}

// 求职端-用户账户信息（积分&余额）
export const getUserAccount = async () => {
  return await request.get({
    url: '/app-api/menduner/system/mde-user/get/account'
  })
}

// 获取聊天秘钥信息
export const getChatKey = async (data) => {
  return await request.post({
    url: '/app-api/im/user/get',
    data
  })
}
// 同步最近会话
export const getConversationSync = async (data) => {
  return await request.post({
    url: '/app-api/im/conversation/sync',
    data
  })
}
// 同步最近会话
export const getMessageSync = async (data) => {
  return await request.post({
    url: '/app-api/im/im/channel/messagesync',
    data
  })
}
// 设置最近会话未读数量
export const setUnread = async (data) => {
  return await request.post({
    url: '/app-api/im/conversations/setUnread',
    data
  })
}
// 设置最近会话未读数量
export const deleteConversation = async (data) => {
  return await request.post({
    url: '/app-api/im/conversation/delete',
    data
  })
}

// 求职端-根据邀请人id获取面试邀约列表
export const getInterviewInviteListByInviteUserId = async (inviteUserId) => {
  return await request.get({
    url: `/app-api/menduner/system/interview-invite/get/list/by/${inviteUserId}`
  })
}

// 获得指定应用的开启的支付渠道编码列表
export const getEnableCodeList = async (params) => {
  return await request.get({
    url: '/app-api/pay/channel/get-enable-code-list',
    params
  })
}

// 获取待支付的订单
export const getUnpaidOrder = async (params) => {
  return await request.get({
    url: '/app-admin-api/menduner/system/trade/order/get/unpaid',
    params
  })
}

// 提交支付订单
export const payOrderSubmit = async (data) => {
  return await request.post({
    // url: '/app-admin-api/menduner/system/pay/order/submit',
    url: '/app-admin-api/pay/order/submit',
    data
  })
}

// 获得支付订单
export const getOrderPayStatus = async (params) => {
  return await request.get({
    url: '/app-admin-api/pay/order/get',
    params
  })
}
