import request from '@/config/axios'

// 设备维修工单日志 VO
export interface WorkOrdersLogsVO {
  id: number // 主键ID
  orderId: number // 设备维修工单ID
  logType: string // 日志类型
  logContent: string // 日志内容
  attachmentUrls: string // 附件链接，多个用逗号分隔
  operatorId: number // 操作人ID
  operatorName: string // 操作人姓名
}

// 设备维修工单日志 API
export const WorkOrdersLogsApi = {
  // 查询设备维修工单日志分页
  getWorkOrdersLogsPage: async (params: any) => {
    return await request.get({ url: `/device/work-orders-logs/page`, params })
  },

  // 查询设备维修工单日志详情
  getWorkOrdersLogs: async (id: number) => {
    return await request.get({ url: `/device/work-orders-logs/get?id=` + id })
  },

  // 新增设备维修工单日志
  createWorkOrdersLogs: async (data: WorkOrdersLogsVO) => {
    return await request.post({ url: `/device/work-orders-logs/create`, data })
  },

  // 修改设备维修工单日志
  updateWorkOrdersLogs: async (data: WorkOrdersLogsVO) => {
    return await request.put({ url: `/device/work-orders-logs/update`, data })
  },

  // 删除设备维修工单日志
  deleteWorkOrdersLogs: async (id: number) => {
    return await request.delete({ url: `/device/work-orders-logs/delete?id=` + id })
  },

  // 导出设备维修工单日志 Excel
  exportWorkOrdersLogs: async (params) => {
    return await request.download({ url: `/device/work-orders-logs/export-excel`, params })
  },
}
