import request from '@/config/axios'

// 巡检工单巡检明细 VO
export interface IotInspectOrderDetailVO {
  id: number // 主键id
  orderId: number // 工单id
  deviceId: number // 设备id
  itemId: number // 巡检项id
  ifNormal: boolean // 是否正常
  description: string // 异常描述
  picUrl: string // 图片
  remark: string // 备注
  deptId: number // 部门id
}

// 巡检工单巡检明细 API
export const IotInspectOrderDetailApi = {
  // 查询巡检工单巡检明细分页
  getIotInspectOrderDetailPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-inspect-order-detail/page`, params })
  },
  getIotInspectItemStatusPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-inspect-order-detail/item`, params })
  },

  // 查询巡检工单巡检明细详情
  getIotInspectOrderDetail: async (id: number) => {
    return await request.get({ url: `/rq/iot-inspect-order-detail/get?id=` + id })
  },

  // 新增巡检工单巡检明细
  createIotInspectOrderDetail: async (data: IotInspectOrderDetailVO) => {
    return await request.post({ url: `/rq/iot-inspect-order-detail/create`, data })
  },

  // 修改巡检工单巡检明细
  updateIotInspectOrderDetail: async (data: IotInspectOrderDetailVO) => {
    return await request.put({ url: `/rq/iot-inspect-order-detail/update`, data })
  },

  // 删除巡检工单巡检明细
  deleteIotInspectOrderDetail: async (id: number) => {
    return await request.delete({ url: `/rq/iot-inspect-order-detail/delete?id=` + id })
  },

  // 导出巡检工单巡检明细 Excel
  exportIotInspectOrderDetail: async (params) => {
    return await request.download({ url: `/rq/iot-inspect-order-detail/export-excel`, params })
  },
}
