import request from '@/config/axios'

// 设备分类 VO
export interface IotInfoClassifyVO {
  id: number // 主键id
  parentId: number // 父分类id
  name: string // 分类名称
  sort: number // 分类排序
  status: number // 开启状态
  deviceId: number
}

// 设备分类 API
export const IotInfoClassifyApi = {
  // 查询设备分类分页
  getIotInfoClassifyPage: async (params: any) => {
    return await request.get({ url: `/rq/iot-info-classify/list`, params })
  },

  // 查询设备分类详情
  getIotInfoClassify: async (id: number) => {
    return await request.get({ url: `/rq/iot-info-classify/get?id=` + id })
  },

  // 新增设备分类
  createIotInfoClassify: async (data: IotInfoClassifyVO) => {
    return await request.post({ url: `/rq/iot-info-classify/create`, data })
  },

  // 修改设备分类
  updateIotInfoClassify: async (data: IotInfoClassifyVO) => {
    return await request.put({ url: `/rq/iot-info-classify/update`, data })
  },
  // 修改资料分类
  removeIotInfoClassify: async (data: IotInfoClassifyVO) => {
    return await request.put({ url: `/rq/iot-info-classify/update/remove`, data })
  },
  // 删除设备分类
  deleteIotInfoClassify: async (id: number) => {
    return await request.delete({ url: `/rq/iot-info-classify/delete?id=` + id })
  },

  // 导出设备分类 Excel
  exportIotInfoClassify: async (params) => {
    return await request.download({ url: `/rq/iot-info-classify/export-excel`, params })
  },
  getSimpleInfotClassifyList: async (id:number): Promise<IotInfoClassifyVO[]> => {
    return await request.get({ url: '/rq/iot-info-classify/simple-list?deviceId=' + id })
  }
}
