import request from '@/config/axios'

// 获取推荐职位
export const getPromotedPosition = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/recommended',
    params
  })
}

// 获取最新发布的职位
export const getLatestPosition = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/latest',
    params
  })
}

// 获取众聘职位
export const getHirePosition = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/hire',
    params
  })
}

// 获取职位详情
export const getPositionDetails = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/detail',
    params
  })
}

// 职位详情-相似职位
export const getSimilarPosition = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/acquainted',
    params
  })
}

// 根据条件搜索招聘职位
export const getJobAdvertisedSearch = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/search',
    params
  })
}

// 效验求职者是否收藏该职位
export const getJobFavoriteCheck = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/person/job/favorite/check',
    params
  })
}

// 求职者收藏职位
export const getPersonJobFavorite = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/person/job/favorite',
    data
  })
}

// 求职者取消收藏职位
export const getPersonJobUnfavorite = async (jobId) => {
  return await request.delete({
    url: `/app-api/menduner/system/person/job/unfavorite?jobId=` + jobId
  })
}

// 根据企业id统计职位类型的数量
export const getJobAdvertisedPositionCount = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/position/count',
    params
  })
}


// 根据企业id获取企业职位区域
export const getJobAreaByEnterpriseId = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job/advertised/get/area/count',
    params
  })
}

// 效验招聘职位是否投递
export const jobCvRelCheckSend = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job-cv-rel/send/check',
    params
  })
}

// 投递简历
export const jobCvRelSend = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/job-cv-rel/send',
    data
  })
}

// 获取已投递的职位列表
export const getJobDeliveryList = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/job-cv-rel/page',
    params
  })
}

// 获取收藏的招聘职位列表
export const getJobFavoriteList = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/person/get/job/favorite/page',
    data
  })
}

// 获取关注的企业列表
export const getSubscribeEnterprise = async (data) => {
  return await request.post({
    url: '/app-api/menduner/system/person/get/enterprise/subscribe/page',
    data
  })
}

// 获取用户收藏职位的数量
export const getPersonJobFavoriteCount = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/person/job/favorite/count',
    params
  })
}

// 获取用户关注企业的数量
export const getPersonEnterpriseSubscribeCount = async (params) => {
  return await request.get({
    url: '/app-api/menduner/system/person/enterprise/subscribe/count',
    params
  })
}

// 招聘端-发布职位
export const saveJobAdvertised = async (data) => {
  return await request.post({
    url: '/app-admin-api/menduner/system/job-advertised/save',
    data
  })
}

// 创建订单
export const createTradeOrder = async (data) => {
  return await request.post({
    url: '/app-admin-api/menduner/system/trade/order/create',
    data
  })
}

// 招聘端-职位列表
export const getJobAdvertisedList = async (params) => {
  return await request.get({
    url: '/app-admin-api/menduner/system/job-advertised/page',
    params
  })
}

// 招聘端-发布职位详情
export const getJobDetails = async (params) => {
  return await request.get({
    url: '/app-admin-api/menduner/system/job-advertised/detail',
    params
  })
}

// 招聘端-刷新职位
export const refreshJobAdvertised = async (ids) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/job-advertised/refresh?ids=${ids}`
  })
}

// 招聘端-开启职位
export const enableJobAdvertised = async (ids) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/job-advertised/enable?ids=${ids}`
  })
}

// 招聘端-关闭职位
export const closeJobAdvertised = async (ids) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/job-advertised/disable?ids=${ids}`,
  })
}

// 招聘端-置顶职位
export const topJobAdvertised = async (ids) => {
  return await request.post({
    url: `/app-admin-api/menduner/system/job-advertised/top?ids=${ids}`
  })
}

// 招聘端-职位详情-认证情况
export const getEnterpriseAuthDetails = async (enterpriseId) => {
  return await request.get({
    url: `/app-api/menduner/system/enterprise/get/auth?enterpriseId=${enterpriseId}`
  })
}