import React from 'react';
import { service } from '@wisdom-utils/utils';
import HistoryInfo from '../index';

const REQUEST_HTTP = 'http';
const REQUEST_METHOD_POST = 'post';
const REQUEST_METHOD_GET = 'get';

const GET_HISTORY_INFO =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/Monitor/Device/SensorsDataForStation'; //获取历史信息

const GET_DICTIONARY_LIST =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/OMS/Data/GetDataDictionaryList'; //获取数据字典信息

// const GET_HISTORY_INFO = '/api/PandaCore/GCK/Device/SensorsDataForStation'; //获取历史信息

// const GET_DICTIONARY_LIST = '/api/PandaCore/OMS/DataManger/GetDataDictionaryList'; //获取数据字典信息

const historyInfoService = {
  getHistoryInfo: {
    url: GET_HISTORY_INFO,
    method: REQUEST_METHOD_POST,
    type: REQUEST_HTTP,
  },
  getDictionaryList: {
    url: GET_DICTIONARY_LIST,
    method: REQUEST_METHOD_GET,
    type: REQUEST_HTTP,
  },
};

const hsService = service(historyInfoService);

const getHistoryInfo = hsService.getHistoryInfo;
const getDictionaryList = hsService.getDictionaryList;

const Demo = () => {
  return (
    <div style={{ height: '800px' }}>
      <HistoryInfo
        title={'指标曲线'}
        tableProps={{ bordered: true }}
        historyInfoService={getHistoryInfo}
        historyInfoParams={initialParams}
        dictionaryService={getDictionaryList}
        dictionaryParams={{ nodeID: 149 }}
      />
    </div>
  );
};

export default Demo;

const initialParams = {
  stream: [
    {
      stationCode: 'EGBF00000022',
      sensors: '进水压力,今日供水量',
      pointVersions: '二供泵房',
      dateFrom: '2021-06-16 13:01:37',
      dateTo: '2021-06-16 14:01:37',
    },
    // {
    //   stationCode: 'EGJZ00000044',
    //   sensors: '进水压力,今日供水量',
    //   pointVersions: '二供机组',
    //   dateFrom: '2021-06-16 13:01:37',
    //   dateTo: '2021-06-16 14:01:37',
    // },
  ],
  ignoreOutliers: false, // 过滤异常值
  isVertical: false, // 是否展示竖表
  zoom: '', // 数据抽稀
  unit: '', // 数据抽稀 min h
};
