import Axios from 'axios'

import {
  TOPO_DISCOVERY_TEMPLATE, TOPO_DISCOVERY_TEMPLATE_QUERY, REQUEST_CONFIG
} from '../../../utils/RequestUrls'

var staticMethods = {
  /**
   * @Description  : 网元发现创建API
   * @author       : ls
   * @date         : 2020/4/23 18:03
   * @param        :
   * @return       :
   */
  addTemplate: function (template) {
    return Axios.post(TOPO_DISCOVERY_TEMPLATE, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : 网元发现修改API
   * @author       : ls
   * @date         : 2020/4/24 9:57
   * @param        :
   * @return       :
   */
  putModifyTemplate: function (template) {
    return Axios.put(TOPO_DISCOVERY_TEMPLATE, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : shanchuAPI
   * @author       : ls
   * @date         : 2020/4/23 19:53
   * @param        :
   * @return       :
   */
  deleteDeleteTemplate: function (keyList) {
    return Axios.delete(TOPO_DISCOVERY_TEMPLATE, {
      data: keyList,
      headers: {'Content-Type': 'application/json', 'Encoding': 'utf-8'}
    })
  },
  /**
   * @Description  : 查询所有API
   * @author       : ls
   * @date         : 2020/4/22 20:32
   * @param        :
   * @return       :
   */
  getTemplateCollection: function () {
    return Axios.get(TOPO_DISCOVERY_TEMPLATE)
  },
  /**
   * @Description  : 条件查询API
   * @author       : ls
   * @date         : 2020/4/22 17:45
   * @param        :
   * @return       :
   */
  putTemplateCollection: function (conditionSet) {
    return Axios.put(TOPO_DISCOVERY_TEMPLATE_QUERY, conditionSet, REQUEST_CONFIG)
  }
}

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