import request from '@/config/axios'

// 设备保养任务工时 VO
export interface MaintenanceTaskHoursVO {
  id: number // 主键ID
  taskId: number // 保养任务ID
  maintainerId: number // 保养人ID
  content: string // 保养内容
  hours: number // 工作时长
}

// 设备保养任务工时 API
export const MaintenanceTaskHoursApi = {
  // 查询设备保养任务工时分页
  getMaintenanceTaskHoursPage: async (params: any) => {
    return await request.get({ url: `/device/maintenance-task-hours/page`, params })
  },

  // 查询设备保养任务工时详情
  getMaintenanceTaskHours: async (id: number) => {
    return await request.get({ url: `/device/maintenance-task-hours/get?id=` + id })
  },

  // 新增设备保养任务工时
  createMaintenanceTaskHours: async (data: MaintenanceTaskHoursVO) => {
    return await request.post({ url: `/device/maintenance-task-hours/create`, data })
  },

  // 新增设备保养任务工时
  taskHourRowCreate: async (data: MaintenanceTaskHoursVO) => {
    return await request.post({ url: `/device/maintenance-task-hours/rowCreate`, data })
  },

  // 修改设备保养任务工时
  updateMaintenanceTaskHours: async (data: MaintenanceTaskHoursVO) => {
    return await request.put({ url: `/device/maintenance-task-hours/update`, data })
  },

  // 删除设备保养任务工时
  deleteMaintenanceTaskHours: async (id: number) => {
    return await request.delete({ url: `/device/maintenance-task-hours/delete?id=` + id })
  },

  // 导出设备保养任务工时 Excel
  exportMaintenanceTaskHours: async (params) => {
    return await request.download({ url: `/device/maintenance-task-hours/export-excel`, params })
  },
}
