import request from "@/utils/request"

// 招聘端-职位列表分页
export const getJobAdvertisedList = (params) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/page',
    method: 'GET',
    params,
    custom: {
      showLoading: true,
      auth: true
    }
  })
}

// 职位列表
export const getJobAdvertised = (params) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/list',
    method: 'GET',
    params,
    custom: {
      showLoading: true,
      auth: true
    }
  })
}

// 获取待支付的订单
export const getUnpaidOrder = (params) => {
  return request({
    url: '/app-api/menduner/system/recruit/trade/order/get/unpaid',
    method: 'GET',
    params,
    custom: {
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-发布职位详情
export const getJobDetails = (params) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/detail',
    method: 'GET',
    params,
    custom: {
      showLoading: true,
      openEncryption: true,
      auth: true
    }
  })
}

// 获取招聘职位扩展信息
export const getJobAdvertisedExtend = (jobId) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/get/extend?jobId=' + jobId,
    method: 'GET',
    custom: {
      showLoading: true,
      auth: true
    }
  })
}

// 创建订单
export const createTradeOrder = (data) => {
  return request({
    url: '/app-api/menduner/system/recruit/trade/order/create',
    method: "POST",
    data,
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-开启职位
export const enableJobAdvertised = (ids) => {
  return request({
    url: `/app-api/menduner/system/recruit/job-advertised/enable?ids=${ids}`,
    method: "POST",
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-关闭职位
export const closeJobAdvertised = (ids) => {
  return request({
    url: `/app-api/menduner/system/recruit/job-advertised/disable?ids=${ids}`,
    method: "POST",
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-置顶职位
export const topJobAdvertised = (ids) => {
  return request({
    url: `/app-api/menduner/system/recruit/job-advertised/top?ids=${ids}`,
    method: "POST",
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-取消置顶职位
export const topJobAdvertisedCancel = (ids) => {
  return request({
    url: `/app-api/menduner/system/recruit/job-advertised/un-top?ids=${ids}`,
    method: "POST",
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 招聘端-刷新职位
export const refreshJobAdvertised = (ids) => {
  return request({
    url: `/app-api/menduner/system/recruit/job-advertised/refresh?ids=${ids}`,
    method: "POST",
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 获取企业发布职位类型权限
export const getEnterprisePubJobTypePermission = () => {
  return request({
    url: '/app-api/menduner/system/recruit/enterprise/get/pub-job-type-perm',
    method: 'GET',
    custom: {
      showLoading: true,
      auth: true
    }
  })
}

// 求职端-发布职位-获取职位模板
export const getRecruitPositionDetails = async (id) => {
  return request({
    url: `/app-api/menduner/system/recruit/position/get?id=${id}`,
    method: 'GET',
    custom: {
      showLoading: true,
      auth: false
    }
  })
}

// 招聘端-发布职位
export const saveJobAdvertised = (data) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/save',
    method: "POST",
    data,
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

// 保存招聘职位扩展信息
export const saveJobAdvertisedExtend = (data) => {
  return request({
    url: '/app-api/menduner/system/recruit/job-advertised/save/extend',
    method: "POST",
    data,
    custom: {
      openEncryption: true,
      showLoading: true,
      auth: true
    }
  })
}

