import request from '@/config/axios'

// 招聘会管理 VO
export interface JobFairManageVO {
  id: number // id
  type: string // 类型
  title: string // 标题
  slogan: string // 口号
  headImg: string // 头图
  backgroundImg: string // 背景图
  bottomImg: string // 底图
  pcHeadImg: string // 头图_PC
  pcBackgroundImg: string // 背景图_PC
  pcBottomImg: string // 底图_PC
  insideColour: string // 内部小区块色号
  jobColour: string // 职位背景色号
  backgroundColour: string // 背景色色号
  shareImg: string // 分享背景图
  startTime: Date // 开始时间
  endTime: Date // 结束时间
  vipRequire: string // 什么等级的vip可以参与
}

// 招聘会管理 API
export const JobFairManageApi = {
  // 查询招聘会管理分页
  getJobFairPage: async (params: any) => {
    return await request.get({ url: `/menduner/system/job-fair/page`, params })
  },

  // 查询招聘会管理详情
  getJobFair: async (id: string) => {
    return await request.get({ url: `/menduner/system/job-fair/get?id=` + id })
  },

  // 新增招聘会管理
  createJobFair: async (data: JobFairManageVO) => {
    return await request.post({ url: `/menduner/system/job-fair/create`, data })
  },

  // 修改招聘会管理
  updateJobFair: async (data: JobFairManageVO) => {
    return await request.put({ url: `/menduner/system/job-fair/update`, data })
  },

  // 删除招聘会管理
  deleteJobFair: async (id: number) => {
    return await request.delete({ url: `/menduner/system/job-fair/delete?id=` + id })
  },

  // 导出招聘会管理 Excel
  exportJobFair: async (params) => {
    return await request.download({ url: `/menduner/system/job-fair/export-excel`, params })
  },

  // 企业职位面试的情况或入职情况
  getEnterpriseInterviewInvite: async (params) => {
    return await request.get({
      url: `/menduner/system/job-fair/analysis/enterprise/interview-invite`, 
      params: { ...params, conversationStatus: '0' }
    })
  },

  // 企业职位的情况
  getEnterpriseJob: async (params) => {
    return await request.get({ url: `/menduner/system/job-fair/analysis/enterprise/job`, params })
  },

  // 企业职位投递的简历情况
  getEnterpriseJobCvRel: async (params) => {
    return await request.get({ url: `/menduner/system/job-fair/analysis/enterprise/job/cv-rel`, params })
  },

  // 企业每个时间的投递简历数量统计
  getEnterpriseJobCvRelBar: async (params) => {
    return await request.get({ url: `/menduner/system/job-fair/analysis/get/job/cv-rel/bar`, params })
  },

  // 用户完成面试数量统计
  getUserInterviewInvite: async (params) => {
    return await request.get({
      url: `/menduner/system/job-fair/analysis/user/interview-invite`,
      params: { ...params, interviewInviteStatus: '3' }
    })
  },

  // 用户投递的简历情况
    getUserJobCvRel: async (params) => {
    return await request.get({ url: `/menduner/system/job-fair/analysis/user/job/cv-rel`, params })
  },

  // 用户投递列表导出
  exportDelivery: async (params) => {
    return await request.download({ url: `/menduner/system/job-fair/analysis/user/job/cv-rel/download`, params })
  },

  // 招聘会门票设置
  updateTicketSettings: async (data: any) => {
    return await request.post({ url: `/menduner/system/job-fair/update/admission`, data })
  },

  // 购买门票企业分页
  getBuyTicketEnterprise: async (params) => {
    return await request.get({ url: `/menduner/system/job-fair/admission/page`, params })
  },

  // 开启招聘会门票权益
  enableTicketRights: async (id) => {
    return await request.post({ url: `/menduner/system/job-fair/admission/enable?id=${id}` })
  },

  // 关闭招聘会门票权益
  disableTicketRights: async (id) => {
    return await request.post({ url: `/menduner/system/job-fair/admission/disable?id=${id}` })
  },

  // 更新招聘会类别
  updateJobFairCategory: async (data: any) => {
    return await request.put({ url: `/menduner/system/job-fair/update-category`, data })
  }
}