import request from '@/config/axios'

// 员工证书 VO
export interface EmployeeCertificateVO {
  id: number // 主键
  employeeId: number // 员工id
  certificateName: string // 证书名称
  certificateType: string // 证书名称
  startTime: Date // 开始时间
  endTime: Date // 结束时间
  certificateFile: string // 证书附件
}

// 员工证书 API
export const EmployeeCertificateApi = {
  // 查询员工证书分页
  getEmployeeCertificatePage: async (params: any) => {
    return await request.get({ url: `/hr/employee-certificate/page`, params })
  },

  getEmployeeCertificateList: async (employeeId: number) => {
    return await request.get({ url: `/hr/employee-certificate/getEmployeeCertificateList?employeeId=`+employeeId})
  },

  // 查询员工证书详情
  getEmployeeCertificate: async (id: number) => {
    return await request.get({ url: `/hr/employee-certificate/get?id=` + id })
  },

  // 新增员工证书
  createEmployeeCertificate: async (data: EmployeeCertificateVO) => {
    return await request.post({ url: `/hr/employee-certificate/create`, data })
  },

  // 修改员工证书
  updateEmployeeCertificate: async (data: EmployeeCertificateVO) => {
    return await request.put({ url: `/hr/employee-certificate/update`, data })
  },

  // 删除员工证书
  deleteEmployeeCertificate: async (id: number) => {
    return await request.delete({ url: `/hr/employee-certificate/delete?id=` + id })
  },

  // 导出员工证书 Excel
  exportEmployeeCertificate: async (params) => {
    return await request.download({ url: `/hr/employee-certificate/export-excel`, params })
  },
}
