import request from '@/config/axios'

// 职位 VO
export interface JobPostVO {
  id: number // 主键ID
  title: string // 职位标题
  description: string // 职位描述
  requirement: string // 职位要求
  cityId: number // 城市ID
  jobCategoryId: number // 职位类别ID
  publishTime: Date // 发布时间
}

// 职位 API
export const JobPostApi = {
  // 查询职位分页
  getJobPostPage: async (params: any) => {
    return await request.get({ url: `/portal/job-post/page`, params })
  },

  // 查询职位详情
  getJobPost: async (id: number) => {
    return await request.get({ url: `/portal/job-post/get?id=` + id })
  },

  // 新增职位
  createJobPost: async (data: JobPostVO) => {
    return await request.post({ url: `/portal/job-post/create`, data })
  },

  // 修改职位
  updateJobPost: async (data: JobPostVO) => {
    return await request.put({ url: `/portal/job-post/update`, data })
  },

  // 删除职位
  deleteJobPost: async (id: number) => {
    return await request.delete({ url: `/portal/job-post/delete?id=` + id })
  },

  // 导出职位 Excel
  exportJobPost: async (params) => {
    return await request.download({ url: `/portal/job-post/export-excel`, params })
  }
}