import request from '@/config/axios'

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

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

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

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

  // 修改设备分类
  updateIotProductClassify: async (data: IotProductClassifyVO) => {
    return await request.put({ url: `/rq/iot-product-classify/update`, data })
  },

  // 删除设备分类
  deleteIotProductClassify: async (id: number) => {
    return await request.delete({ url: `/rq/iot-product-classify/delete?id=` + id })
  },

  // 导出设备分类 Excel
  exportIotProductClassify: async (params) => {
    return await request.download({ url: `/rq/iot-product-classify/export-excel`, params })
  },
  getSimpleProductClassifyList: async (): Promise<IotProductClassifyVO[]> => {
    return await request.get({ url: '/rq/iot-product-classify/simple-list' })
  }
}
