import request from '@/config/axios'

// 职位类别 VO
export interface JobCategoryVO {
  id: number // 主键ID
  name: string // 类别名称
  parentId: number // 父类别ID
}

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

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

  // 新增职位类别
  createJobCategory: async (data: JobCategoryVO) => {
    return await request.post({ url: `/portal/job-category/create`, data })
  },

  // 修改职位类别
  updateJobCategory: async (data: JobCategoryVO) => {
    return await request.put({ url: `/portal/job-category/update`, data })
  },

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

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