import {
  ALARM_ADMQ,
  ALARM_CONFIRM,
  ALARM_DELETE,
  REQUEST_CONFIG,
  ALARM_CLEARUP
} from '../../utils/RequestUrls'
import Axios from 'axios'

var staticMethods = {
  // 获取所有告警
  getAlarmCollection: function () {
    return Axios.get(ALARM_ADMQ)
  },
  // 告警确认
  putAlarmConfirm: function (alarmKeys) {
    return Axios.put(ALARM_CONFIRM, alarmKeys, REQUEST_CONFIG)
  },
  // 告警清除
  putAlarmClearup: function (alarmKeys) {
    return Axios.put(ALARM_CLEARUP, alarmKeys, REQUEST_CONFIG)
  },
  // 告警删除
  putAlarmDelete: function (alarmKeys) {
    return Axios.delete(ALARM_DELETE, {
      data: alarmKeys,
      REQUEST_CONFIG
    })
  }

  // // 设备的批量删除
  // batchDeleteDevice: function (deviceKeyList) {
  //   return Axios.delete(DEVICE_ADMQ,{
  //     data:deviceKeyList,
  //     headers:{'Content-Type':'application/json','Encoding':'utf-8'}
  //   });
  // },
}

function AlarmAPI (websocketService = null) {
  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(AlarmAPI, staticMethods)
export default AlarmAPI
