import request from '@/config/axios'

// 保养计划明细 VO
export interface IotMaintenanceDetailsVO {
  id: number // 主键id
  planId: number // 保养计划id
  deviceId: number // 设备id
  deviceAssetNumber: string // 设备资产编号
  deviceName: string // 设备名称
  deviceCategory: string // 设备类别
  deviceBrand: string // 设备品牌
  runningKilometers: number // 当前运行公里数(km)
  runningTime: number // 当前运行时间(小时)
  naturalDate: number // 自然日期(天)
  remark: string // 备注
  sort: number // 排序
  status: number // 状态 0启用  1停用
}

// 保养计划明细 API
export const IotMaintenanceDetailsApi = {
  // 查询保养计划明细分页
  getIotMaintenanceDetailsPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-maintenance-details/page`, params })
  },

  // 查询保养计划明细详情
  getIotMaintenanceDetails: async (id: number) => {
    return await request.get({ url: `/rq/iot-maintenance-details/get?id=` + id })
  },

  // 新增保养计划明细
  createIotMaintenanceDetails: async (data: IotMaintenanceDetailsVO) => {
    return await request.post({ url: `/rq/iot-maintenance-details/create`, data })
  },

  // 修改保养计划明细
  updateIotMaintenanceDetails: async (data: IotMaintenanceDetailsVO) => {
    return await request.put({ url: `/rq/iot-maintenance-details/update`, data })
  },

  // 删除保养计划明细
  deleteIotMaintenanceDetails: async (id: number) => {
    return await request.delete({ url: `/rq/iot-maintenance-details/delete?id=` + id })
  },

  // 导出保养计划明细 Excel
  exportIotMaintenanceDetails: async (params) => {
    return await request.download({ url: `/rq/iot-maintenance-details/export-excel`, params })
  },
}
