import request from '@/config/axios'

// 查询设备列表
export function listDevice(query) {
    return request.get({
        url: '/iot/device/list',
       
        params: query,
    });
}

// 查询未授权设备列表
export function listUnAuthDevice(query) {
    return request.get({
        url: '/iot/device/unAuthlist',
       
        params: query,
    });
}

// 查询分组可添加设备分页列表
export function listDeviceByGroup(query) {
    return request.get({
        url: '/iot/device/listByGroup',
        
        params: query,
    });
}

// 查询设备简短列表
export function listDeviceShort(query) {
    return request.get({
        url: '/rq/yf-iot-device/shortList',
       
        params: query,
    });
}

// 查询所有设备简短列表
export function listAllDeviceShort() {
    return request.get({
        url: '/iot/device/all',
        
    });
}

// 查询设备详细
export function getDevice(deviceId) {
    return request.get({
        url: '/rq/yf-iot-device/' + deviceId,
        
    });
}

// 设备数据同步
export function deviceSynchronization(serialNumber) {
    return request.get({
        url: '/iot/device/synchronization/' + serialNumber,
       
    });
}

// 根据设备编号查询设备详细
export function getDeviceBySerialNumber(serialNumber) {
    return request.get({
        url: '/iot/device/getDeviceBySerialNumber/' + serialNumber,
       
    });
}

// 查询设备统计信息
export function getDeviceStatistic() {
    return request.get({
        url: '/iot/device/statistic',
       
    });
}

// 选择分配设备
export function distributionDevice(deptId, deviceIds) {
    return request.post({
        url: '/iot/device/assignment?deptId=' + deptId + '&deviceIds=' + deviceIds,
       
    });
}
//回收设备
export function recycleDevice(deviceIds, recoveryDeptId) {
    return request.post({
        url: '/iot/device/recovery?deviceIds=' + deviceIds + '&recoveryDeptId=' + recoveryDeptId,
        
    });
}
//查询设备导入记录
export function listImportRecord(params) {
    return request.get({
        url: '/iot/record/list',
       
        params: params,
    });
}
//查询设备回收记录
export function listRecycleRecord(params) {
    return request.get({
        url: '/iot/record/list',
       
        params: params,
    });
}
//查询设备分配记录
export function listAllotRecord(params) {
    return request.get({
        url: '/iot/record/list',
      
        params: params,
    });
}

// 查询设备运行状态详细
export function getDeviceRunningStatus(params) {
    return request.get({
        url: '/iot/device/runningStatus',
      
        params: params,
    });
}

// 查询设备物模型的值
export function getDeviceThingsModelValue(deviceId) {
    return request.get({
        url: '/iot/device/thingsModelValue/' + deviceId,
       
    });
}

// 新增设备
export function addDevice(data) {
    return request.post({
        url: '/rq/yf-iot-device',
        
        data: data,
    });
}

// 修改设备
export function updateDevice(data) {
    return request.put({
        url: '/rq/yf-iot-device',
       
        data: data,
    });
}

// 删除设备
export function delDevice(deviceId) {
    return request.delete({
        url: '/rq/yf-iot-device/' + deviceId,
       
    });
}

// 生成设备编号
export function generatorDeviceNum(params) {
    return request.get({
        url: '/rq/yf-iot-device/generator',
        
        params: params,
    });
}

export function getGwDevCode(params) {
    return request.get({
        url: '/iot/device/gwDevCount',
        
        params: params,
    });
}

//mqtt连接参数查看
export function getMqttConnect(params) {
    return request.get({
        url: '/iot/device/getMqttConnectData',
        
        params: params,
    });
}


// 查询设备变量概况
export function listThingsModel(query) {
    return request.get({
        url: '/iot/device/listThingsModel',
       
        params: query,
    });
}

// 查询设备历史轨迹
export function getdevicehis(params) {
    return request.get({
        url: '/iot/device/devicehis',
       
        params: params,
    });
}

// 测试dtu
export function getDevDtu(data) {
    return request.post({
        url: '/iot/device/getDevDtu',
       
        data: data,
    });
}

export function getDtuDeviceList(params) {
    return request.get({
        url: '/iot/device/getDtuDeviceList',
       
        params: params,
    });
}

export function addDeviceUsers(data) {
    return request.post({
        url: '/iot/device/addDeviceUsers',
      
        data: data,
    });
}

export function getDtuDeviceGroup() {
    return request.get({
        url: '/iot/device/getDtuDeviceGroup',
       
    });
}

export function updateDtuDevice(data) {
    return request.post({
        url: '/iot/device/updateDtuDevice',
      
        data: data,
    });
}

export function deleteDtuDevice(data) {
    return request.post({
        url: '/iot/device/deleteDtuDevice',
      
        data: data,
    });
}

export function getDtuDeviceGroupList(params) {
    return request.get({
        url: '/iot/device/getDtuDeviceGroupList',
        
        params: params,
    });
}

export function addAndUpdateDtuDevGroup(data) {
    return request.post({
        url: '/iot/device/addAndUpdateDtuDevGroup',
       
        data: data,
    });
}

export function deleteDtuDeviceGroup(params) {
    return request.get({
        url: '/iot/device/deleteDtuDeviceGroup',
        
        params: params,
    });
}

export function selectDeviceAisfptList(params) {
    return request.get({
        url: '/iot/device/selectDeviceAisfptList',
       
        params: params,
    });
}

export function addAndUpdateDeviceAisfpt(data) {
    return request.post({
        url: '/iot/device/addAndUpdateDeviceAisfpt',
        
        data: data,
    });
}

export function deleteDeviceAisfpt(params) {
    return request.get({
        url: '/iot/device/deleteDeviceAisfpt',
       
        params: params,
    });
}

export function getDeviceAbnormalList(query) {
    return request.get({
        url: `/iot/device/getDeviceAbnormalList`,
       
        params: query
    })
}

export function updateMqttConnectData(query) {
    return request.post({
        url: `/iot/device/updateMqttConnectData`,
       
        data: query
    })
}

// 查询设备统计信息
export function getdeviceBoardList() {
    return request.get({
        url: '/iot/device/deviceBoardList',
       
    });
}


// 根据经纬度来查询地图上的数据
export function deviceLongitudeAndLatitudeApi() {
    return request.get({
        url: '/iot/device/deviceLongitudeAndLatitude',
       
    });
}