import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TemperatureHumidityVO, TemperatureHumidityForm, TemperatureHumidityQuery } from '@/api/ems/report/types';

/**
 * 查询温湿度监控列表
 */
export function listTemperatureHumidity(query: TemperatureHumidityQuery): AxiosPromise<TemperatureHumidityVO[]> {
  return request({
    url: '/ems/report/temperatureHumidity/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询温湿度监控详细
 */
export function getTemperatureHumidity(objId: string | number): AxiosPromise<TemperatureHumidityVO> {
  return request({
    url: '/ems/report/temperatureHumidity/' + objId,
    method: 'get'
  });
}

/**
 * 新增温湿度监控
 */
export function addTemperatureHumidity(data: TemperatureHumidityForm): AxiosPromise<any> {
  return request({
    url: '/ems/report/temperatureHumidity',
    method: 'post',
    data: data
  });
}

/**
 * 查询实时温湿度数据
 */
export function getRealTimeData(monitorId: string | number): AxiosPromise<TemperatureHumidityVO> {
  return request({
    url: '/ems/report/temperatureHumidity/realtime/' + monitorId,
    method: 'get'
  });
}

/**
 * 导出温湿度监控数据
 */
export function exportTemperatureHumidity(query: TemperatureHumidityQuery) {
  return request({
    url: '/ems/report/temperatureHumidity/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  });
}

export function iotInstantMonitoring(query) {
  return request({
    url: '/ems/record/recordIOTInstant/iotInstantMonitoring',
    method: 'get',
    params: query
  })
}
