import request from '@/config/axios'

// 设备类别 VO
export interface CategoryVO {
  id: number // 主键
  parentId: number // 上级ID
  categoryName: number // 类别名称
  model: number // 场景
  sort: number // 显示顺序
}

// 设备类别 API
export const CategoryApi = {
  // 查询设备类别列表
  getCategoryList: async (params) => {
    return await request.get({ url: `/device/category/list`, params })
  },

  // 查询设备类别详情
  getCategory: async (id: number) => {
    return await request.get({ url: `/device/category/get?id=` + id })
  },

  // 新增设备类别
  createCategory: async (data: CategoryVO) => {
    return await request.post({ url: `/device/category/create`, data })
  },

  // 修改设备类别
  updateCategory: async (data: CategoryVO) => {
    return await request.put({ url: `/device/category/update`, data })
  },

  // 删除设备类别
  deleteCategory: async (id: number) => {
    return await request.delete({ url: `/device/category/delete?id=` + id })
  },

  // 导出设备类别 Excel
  exportCategory: async (params) => {
    return await request.download({ url: `/device/category/export-excel`, params })
  },
}
