import {ELINE_ADMQ, ELINE_QUERY,ELINE_DEVICE, REQUEST_CONFIG, TUNNEL_ADMQ, TUNNEL_BANDWIDTH} from "../../../utils/RequestUrls";
import Axios from 'axios'

var staticMethods = {
  //获取所有Eline（待测试及确认）
  getElineCollection: function(){
    return Axios.get(ELINE_ADMQ);
  },

  //新增Eline（待测试及确认）
  postElineAdd:function (eline) {
    return Axios.post(ELINE_ADMQ, eline, REQUEST_CONFIG);
  },

  //修改Eline（待测试及确认）
  putElineUpdate:function (eline) {
    return Axios.put(ELINE_ADMQ, eline, REQUEST_CONFIG);
  },

  //删除Eline（待测试及确认）
  deleteElineDelete:function (elineKeyList) {
    return Axios.delete(ELINE_ADMQ,{
      data:elineKeyList,
      headers:{'Content-Type':'application/json','Encoding':'utf-8'}
    });
  },
  //条件查询Eline（待测试及确认）
  getElineByCondition:function (selectList) {
    return Axios.put(ELINE_QUERY, selectList, REQUEST_CONFIG);
  },
  //获取设备列表（待测试及确认）
  getElineDeviceList:function (serviceTypeID) {
    return Axios.put(ELINE_DEVICE + '/' + serviceTypeID);
  },

  //获取所有路由路径
  getTunnelCollection:function () {
    return Axios.get(TUNNEL_ADMQ);
  },

  //获取业务路由路径
  getServiceTunnelCollection:function (vpnid) {
    return Axios.get(TUNNEL_ADMQ + '/' + vpnid);
  },

  //获取所有路由路径new
  getTunnelBandwidthCollection:function () {
    return Axios.get(TUNNEL_BANDWIDTH);
  },
}

function ElineAPI (websocketService = null) {

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