import request from '@/config/axios'

// 设备位置 VO
export interface LocationVO {
  id: number // 主键
  parentId: number // 上级ID
  locationName: number // 位置名称
  sort: number // 显示顺序
}

// 设备位置 API
export const LocationApi = {
  // 查询设备位置列表
  getLocationList: async (params) => {
    return await request.get({ url: `/device/location/list`, params })
  },

  // 查询设备位置详情
  getLocation: async (id: number) => {
    return await request.get({ url: `/device/location/get?id=` + id })
  },

  // 新增设备位置
  createLocation: async (data: LocationVO) => {
    return await request.post({ url: `/device/location/create`, data })
  },

  // 修改设备位置
  updateLocation: async (data: LocationVO) => {
    return await request.put({ url: `/device/location/update`, data })
  },

  // 删除设备位置
  deleteLocation: async (id: number) => {
    return await request.delete({ url: `/device/location/delete?id=` + id })
  },

  // 导出设备位置 Excel
  exportLocation: async (params) => {
    return await request.download({ url: `/device/location/export-excel`, params })
  },
}
