import Axios from 'axios'

import {
  RT_PERFORMANCE_URL,
  RT_PERFORMANCE_TYPE,
  RT_PERFORMANCE_TYPE_NEW,
  REQUEST_CONFIG,
} from "../../utils/RequestUrls";

var staticMethods = {
  // 性能数据按条件查询：总条数
  rtPerformanceDatas: function (selectList, port, event) {
    let {status, ...pick} = selectList
    var a = port.length === 0 ? '-1' : port
    // let b = {
    //   device: pick,
    //   port: port
    // }
    return Axios.put(RT_PERFORMANCE_URL + '/' + a + '/' + event, pick, REQUEST_CONFIG)
  },
  getAllRtEventType: function () {
    return Axios.get(RT_PERFORMANCE_TYPE, REQUEST_CONFIG)
  },
  getAllRtPerformType: function (device) {
    let {status, ...pick} = device
    return Axios.put(RT_PERFORMANCE_TYPE_NEW, pick, REQUEST_CONFIG)
  }
}

function RtPerformanceAPI (websocketService = null) {

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