import request from '@/config/axios'

// 安全员类型定义
export interface Officer {
  id?: number | string
  name: string
  phone: string
  email: string
  department: string
  status: 'active' | 'inactive'
}

// 分页查询参数
export enum OfficerStatus {
  Active = 'active',
  Inactive = 'inactive',
}

export interface OfficerPageParams {
  pageNo: number
  pageSize: number
  name?: string
  department?: string
  status?: OfficerStatus | string
}

// 分页查询
export const getOfficerPage = (params: OfficerPageParams) => {
  return request.get({ url: '/safe/officer/page', params })
}

// 新增安全员
export const createOfficer = (data: Officer) => {
  return request.post({ url: '/safe/officer/create', data })
}

// 更新安全员
export const updateOfficer = (data: Officer) => {
  return request.put({ url: '/safe/officer/update', data })
}

// 删除安全员
export const deleteOfficer = (id: number | string) => {
  return request.delete({ url: `/safe/officer/delete?id=${id}` })
}
 