import request from '@/config/axios'

// 设备数据记录 VO
export interface MqttDataRecordVO {
  id: number // ID
  deviceName: string // 设备
  attribute: string // 属性
  attrValue: string // 属性值
  deviceTime: number
  createTime: number
}

// 设备数据记录 API
export const MqttDataRecordApi = {
  // 查询设备数据记录分页
  getMqttDataRecordPage: async (params: any) => {
    return await request.get({ url: `/iot/mqtt-data-record/page`, params })
  },
// 查询设备数据记录分页
  getMqttDataRecordPage2: async (params: any) => {
    return await request.get({ url: `/iot/mqtt-data-record/page2`, params })
  },
  // 查询设备数据记录详情
  getMqttDataRecord: async (id: number) => {
    return await request.get({ url: `/iot/mqtt-data-record/get?id=` + id })
  },

  // 新增设备数据记录
  createMqttDataRecord: async (data: MqttDataRecordVO) => {
    return await request.post({ url: `/iot/mqtt-data-record/create`, data })
  },

  // 修改设备数据记录
  updateMqttDataRecord: async (data: MqttDataRecordVO) => {
    return await request.put({ url: `/iot/mqtt-data-record/update`, data })
  },

  // 删除设备数据记录
  deleteMqttDataRecord: async (id: number) => {
    return await request.delete({ url: `/iot/mqtt-data-record/delete?id=` + id })
  },

  // 导出设备数据记录 Excel
  exportMqttDataRecord: async (params) => {
    return await request.download({ url: `/iot/mqtt-data-record/export-excel`, params })
  }
}
