import request from '@/config/axios'

// 员工合同 VO
export interface EmployeeContractVO {
  id: number // 主键
  employeeId: number // 员工id
  contractName: string // 合同名称
  startTime: Date // 开始时间
  endTime: Date // 结束时间
  contractFile: string // 合同附件
}

// 员工合同 API
export const EmployeeContractApi = {
  // 查询员工合同分页
  getEmployeeContractPage: async (params: any) => {
    return await request.get({ url: `/hr/employee-contract/page`, params })
  },

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

  // 查询员工合同详情
  getEmployeeContract: async (id: number) => {
    return await request.get({ url: `/hr/employee-contract/get?id=` + id })
  },

  // 新增员工合同
  createEmployeeContract: async (data: EmployeeContractVO) => {
    return await request.post({ url: `/hr/employee-contract/create`, data })
  },

  // 修改员工合同
  updateEmployeeContract: async (data: EmployeeContractVO) => {
    return await request.put({ url: `/hr/employee-contract/update`, data })
  },

  // 删除员工合同
  deleteEmployeeContract: async (id: number) => {
    return await request.delete({ url: `/hr/employee-contract/delete?id=` + id })
  },

  // 导出员工合同 Excel
  exportEmployeeContract: async (params) => {
    return await request.download({ url: `/hr/employee-contract/export-excel`, params })
  },
  //校验姓名、手机号码是否存在
  hrEmployeeValidate: async (params) => {
    return await request.get({ url: `/hr/employee/validate`, params })
  },
  //生成默认工号
  hrEmployeeGetCode: async () => {
    return await request.get({ url: `/hr/employee/getCode` })
  }
}
