import request from '@/config/axios'

export interface EmployeeVO {
  id?: number
  employeeName: string
  gender: string
  officeId: number
  officeName?: string
  registrationType?: string
  jobTitle?: string
  registrationSealNo?: string
  entryDate?: string
  leaveDate?: string
  employeeStatus: string
  remark?: string
  sortNo?: number
  enabledFlag?: boolean
  createTime?: string
}

export interface EmployeePageReqVO extends PageParam {
  employeeName?: string
  officeId?: number
  employeeStatus?: string
  enabledFlag?: boolean
}

export interface EmployeeSimpleVO {
  id: number
  employeeName: string
  officeId?: number
  officeName?: string
  employeeStatus?: string
  registrationType?: string
  jobTitle?: string
}

export const getEmployeePage = (params: EmployeePageReqVO) => {
  return request.get({ url: '/tjt/employee/page', params })
}

export const getEmployee = (id: number) => {
  return request.get({ url: '/tjt/employee/get', params: { id } })
}

export const createEmployee = (data: EmployeeVO) => {
  return request.post({ url: '/tjt/employee/create', data })
}

export const updateEmployee = (data: EmployeeVO) => {
  return request.put({ url: '/tjt/employee/update', data })
}

export const deleteEmployee = (id: number) => {
  return request.delete({ url: '/tjt/employee/delete', params: { id } })
}

export const getEmployeeSimpleList = (params: {
  keyword?: string
  officeId?: number
  status?: string
  enabledFlag?: boolean
}) => {
  return request.get({ url: '/tjt/employee/simple-list', params })
}
