import Axios from 'axios'

import {REQUEST_CONFIG, PERFORMANCE_STATISTIC, PERFORMANCE_REPORT, RT_PERFORMANCE_TYPE} from "../../utils/RequestUrls";

var staticMethods = {
  /**
   * @Description  : 获取性能事件
   * @author       : ls
   * @date         : 2020/5/12 16:44
   * @param        :
   * @return       :
   */
  getPerformTypeAPI: function () {
    return Axios.get(RT_PERFORMANCE_TYPE, REQUEST_CONFIG)
  },
  /**
   * @Description  :
   * @author       : ls
   * @date         : 2020/5/12 17:46
   * @param        :
   * @return       :
   */
  queryPerformDistributionReportApi: function () {
    return Axios.get(RT_PERFORMANCE_TYPE, REQUEST_CONFIG)
  },
  // 性能数据按条件查询：统计图数据
  putPerformanceStatistic: function (valueType,statisticsList) {
    return Axios.put(PERFORMANCE_STATISTIC+valueType+"/",statisticsList,REQUEST_CONFIG)
  },

  putPerformanceReports: function (valueType,valueTopN,statisticsList) {
    return Axios.put(PERFORMANCE_REPORT+valueType+"/"+valueTopN,statisticsList,REQUEST_CONFIG)
  }
};

function PerformanceStatisticAPI (websocketService = null) {

  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(PerformanceStatisticAPI, staticMethods);
export default PerformanceStatisticAPI
