import { request } from '@wisdom-utils/utils';

const REQUEST_METHOD_GET = 'get';
const REQUEST_METHOD_POST = 'post';
// eslint-disable-next-line no-undef
const baseUrl = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api' : '';

const monitorDeviceUrl = `${baseUrl}/PandaMonitor/Monitor/Device`;
// 获取历史数据
export function getHistoryInfo(data) {
  return request({
    url: `${monitorDeviceUrl}/GetSensorsDataForStation`,
    method: REQUEST_METHOD_POST,
    data,
  });
}

// 获取指标报警方案配置
export function getDeviceAlarmScheme(option) {
  return request({
    url: `${monitorDeviceUrl}/GetDeviceAlarmScheme`,
    method: REQUEST_METHOD_POST,
    ...option,
  });
}

// 导出设备指标历史数据
export function getExportDeviceHistoryUrl(data) {
  return request({
    url: `${monitorDeviceUrl}/ExportDeviceHistoryInfo`,
    method: REQUEST_METHOD_POST,
    data,
  });
}
