import request from '@/config/axios'

// 采集设备模型 VO
export interface DeviceModelVO {
  id: number // ID
  code: string // 分类编码
  name: string // 分类名称
  protocol: string // 通讯协议
  remark: string // 备注
}

// 采集设备模型 API
export const DeviceModelApi = {
  // 查询采集设备模型分页
  getDeviceModelPage: async (params: any) => {
    return await request.get({ url: `/iot/device-model/page`, params })
  },

  // 查询采集设备模型详情
  getDeviceModel: async (id: number) => {
    return await request.get({ url: `/iot/device-model/get?id=` + id })
  },

  // 新增采集设备模型
  createDeviceModel: async (data: DeviceModelVO) => {
    return await request.post({ url: `/iot/device-model/create`, data })
  },

  // 修改采集设备模型
  updateDeviceModel: async (data: DeviceModelVO) => {
    return await request.put({ url: `/iot/device-model/update`, data })
  },

  // 删除采集设备模型
  deleteDeviceModel: async (ids: string) => {
    return await request.delete({ url: `/iot/device-model/delete?ids=` + ids })
  },

  // 复制采集设备模型
  copyDeviceModel: async (id: number) => {
    return await request.post({ url: `/iot/device-model/copy`, params: { id } })
  },

  // 导出采集设备模型 Excel
  exportDeviceModel: async (params) => {
    return await request.download({ url: `/iot/device-model/export-excel`, params })
  },

  // 获得采集设备模型列表
  getDeviceModelList: async () => {
    return await request.get({ url: `/iot/device-model/list` })
  },
}
