import type { Device, DevicePropertie, GetDeviceListParams } from './types' import { defHttp } from '@/utils/http/axios' export function getDeviceList(params: GetDeviceListParams) { return defHttp.get>({ url: '/device/page', params, }) } export function createDevice(data: Partial) { return defHttp.post({ url: '/device/save', data, }) } export function updateDevice(data: Partial) { return defHttp.post({ url: '/device/update', data, }) } export function deleteDevice(id: string) { return defHttp.post({ url: `/device/remove?id=${id}`, }) } export function getDeviceDetail(id: string) { return defHttp.get({ url: '/device/detail', params: { id, }, }) } export function getDeviceProperties(modelId: string, deviceSn: string) { return defHttp.get<{ properties?: DevicePropertie[] updateTime?: string }>({ url: '/device/properties', params: { deviceSn, modelId, }, }) } export function getDeviceTopicList(params: PageParam & { deviceId: string }) { return defHttp.get({ url: '/device/topic/page', params, }) } export function getMqttConnectParams(deviceId: string) { return defHttp.get({ url: '/device/mqttLinkInfo', params: { deviceId, }, }) } export function getReportExample(productId: string, deviceSn: string) { return defHttp.get({ url: '/device/messageExample', params: { productId, deviceSn, }, }) }