"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.downloadIecTmpl = exports.deleteIecChannelPoint = exports.getIecChannelPoint = exports.deletePoint = exports.addPoint = exports.deleteChannelPoint = exports.getChannelPoint = exports.deleteChannel = exports.createChannel = exports.getChannelByType = exports.fetchTopoDeviceAction = exports.fetchCapacityInterfaceAction = exports.fetchTopoEquipmentAction = exports.fetchAllTemplatOrEqpQuotaPropertyAction = exports.addEditEquipmentAction = exports.fetchTemplatOrEqpQuotaPropertyAction = exports.fetchTemplatOrEqpQuotaAction = exports.fetchCapacityListInfoAction = exports.deleteEquipmentTemplateAction = exports.deleteEquipmentAction = exports.editEquipmentNameAction = exports.fetchTemplatOrEqpIntfcAction = exports.fetchTemplatEquipmentsAction = exports.fetchTemplateStatisticsAction = void 0;

var _urlFormat = _interopRequireDefault(require("amos-processor/lib/utils/urlFormat")), _urlConsts = _interopRequireWildcard(require("../consts/urlConsts")), _request = require("../utils/request");

function _getRequireWildcardCache(e) {
  if ("function" != typeof WeakMap) return null;
  var t = new WeakMap, n = new WeakMap;
  return (_getRequireWildcardCache = function(e) {
    return e ? n : t;
  })(e);
}

function _interopRequireWildcard(e, t) {
  if (!t && e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var n = _getRequireWildcardCache(t);
  if (n && n.has(e)) return n.get(e);
  var o = {}, r = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var c in e) if ("default" !== c && Object.prototype.hasOwnProperty.call(e, c)) {
    var a = r ? Object.getOwnPropertyDescriptor(e, c) : null;
    a && (a.get || a.set) ? Object.defineProperty(o, c, a) : o[c] = e[c];
  }
  return o.default = e, n && n.set(e, o), o;
}

var fetchTemplateStatisticsAction = function(e) {
  return (0, _request.commonPost)(_urlConsts.default.fetchTemplateStatistics, e);
};

exports.fetchTemplateStatisticsAction = fetchTemplateStatisticsAction;

var fetchTemplatEquipmentsAction = function(e, t) {
  var n = "".concat(_urlConsts.default.fetchTemplatEquipments, "/").concat(e);
  return (0, _request.commonPost)(n, t);
};

exports.fetchTemplatEquipmentsAction = fetchTemplatEquipmentsAction;

var fetchTemplatOrEqpIntfcAction = function(e, t) {
  t = void 0 === t ? 0 : t;
  var n = "".concat(_urlConsts.default.fetchTemplatOrEqpIntfc, "/").concat(e, "/").concat(t, "/intfcs");
  return (0, _request.commonGet)(n);
};

exports.fetchTemplatOrEqpIntfcAction = fetchTemplatOrEqpIntfcAction;

var editEquipmentNameAction = function(e) {
  return (0, _request.commonPost)(_urlConsts.default.editEquipmentName, e);
};

exports.editEquipmentNameAction = editEquipmentNameAction;

var deleteEquipmentAction = function(e) {
  var t = "".concat(_urlConsts.default.delEquipmentById);
  return (0, _request.commonDelete)(t, e);
};

exports.deleteEquipmentAction = deleteEquipmentAction;

var deleteEquipmentTemplateAction = function(e) {
  var t = "".concat(_urlConsts.default.deleteDeviceById, "/").concat(e);
  return (0, _request.commonDelete)(t);
};

exports.deleteEquipmentTemplateAction = deleteEquipmentTemplateAction;

var fetchCapacityListInfoAction = function(e) {
  var t = "".concat(_urlConsts.default.fetchCapacityListInfoById, "/").concat(e);
  return (0, _request.commonGet)(t);
};

exports.fetchCapacityListInfoAction = fetchCapacityListInfoAction;

var fetchTemplatOrEqpQuotaAction = function(e, t) {
  t = void 0 === t ? 0 : t;
  var n = "".concat(_urlConsts.default.fetchTemplatOrEqpQuota, "/").concat(e, "/").concat(t, "/cpbls");
  return (0, _request.commonGet)(n);
};

exports.fetchTemplatOrEqpQuotaAction = fetchTemplatOrEqpQuotaAction;

var fetchTemplatOrEqpQuotaPropertyAction = function(e, t) {
  e = void 0 === e ? 0 : e;
  var n = "".concat(_urlConsts.default.fetchTemplatOrEqpQuota, "/").concat(e, "/").concat(t, "/cpblAttrs");
  return (0, _request.commonGet)(n);
};

exports.fetchTemplatOrEqpQuotaPropertyAction = fetchTemplatOrEqpQuotaPropertyAction;

var addEditEquipmentAction = function(e) {
  return (0, _request.commonPost)(_urlConsts.default.addEditEquipment, e);
};

exports.addEditEquipmentAction = addEditEquipmentAction;

var fetchAllTemplatOrEqpQuotaPropertyAction = function(e, t) {
  t = void 0 === t ? 0 : t;
  var n = "".concat(_urlConsts.default.fetchTemplatOrEqpQuota, "/").concat(e, "/").concat(t, "/eqpCpblAttrs");
  return (0, _request.commonGet)(n);
};

exports.fetchAllTemplatOrEqpQuotaPropertyAction = fetchAllTemplatOrEqpQuotaPropertyAction;

var fetchTopoEquipmentAction = function(e) {
  return (0, _request.commonPost)(_urlConsts.default.getRealDevice, e);
};

exports.fetchTopoEquipmentAction = fetchTopoEquipmentAction;

var fetchCapacityInterfaceAction = function(e) {
  var t = "".concat(_urlConsts.default.fetchCapacityInterface, "/").concat(e);
  return (0, _request.commonGet)(t);
};

exports.fetchCapacityInterfaceAction = fetchCapacityInterfaceAction;

var fetchTopoDeviceAction = function(e) {
  var t = "".concat(_urlConsts.default.fetchTopoDevice, "/").concat(e);
  return (0, _request.commonGet)(t);
};

exports.fetchTopoDeviceAction = fetchTopoDeviceAction;

var getChannelByType = function(e) {
  var t = (0, _urlFormat.default)(_urlConsts.IecUrl.channelListUrl, {
    type: e
  });
  return (0, _request.commonGet)(t);
};

exports.getChannelByType = getChannelByType;

var createChannel = function(e) {
  return (0, _request.commonPost)(_urlConsts.IecUrl.channelUrl, e);
};

exports.createChannel = createChannel;

var deleteChannel = function(e) {
  var t = (0, _urlFormat.default)(_urlConsts.IecUrl.deleteChannelUrl, {
    id: e
  });
  return (0, _request.commonDelete)(t);
};

exports.deleteChannel = deleteChannel;

var getChannelPoint = function(e) {
  var t = (0, _urlFormat.default)(_urlConsts.IecUrl.channelPointUrl, {
    channel: e
  });
  return (0, _request.commonGet)(t);
};

exports.getChannelPoint = getChannelPoint;

var deleteChannelPoint = function(e) {
  var t = (0, _urlFormat.default)(_urlConsts.IecUrl.channelPointUrl, {
    channel: e
  });
  return (0, _request.commonDelete)(t);
};

exports.deleteChannelPoint = deleteChannelPoint;

var addPoint = function(e) {
  return (0, _request.commonPost)(_urlConsts.IecUrl.pointUrl, e);
};

exports.addPoint = addPoint;

var deletePoint = function(e) {
  var t = (0, _urlFormat.default)(_urlConsts.IecUrl.deletePointUrl, {
    ids: e
  });
  return (0, _request.commonDelete)(t);
};

exports.deletePoint = deletePoint;

var getIecChannelPoint = function(e, t) {
  var n = (0, _urlFormat.default)(_urlConsts.IecUrl.iecChannelPointUrl, {
    channelNo: e,
    pointType: t
  });
  return (0, _request.commonGet)(n);
};

exports.getIecChannelPoint = getIecChannelPoint;

var deleteIecChannelPoint = function(e, t) {
  var n = (0, _urlFormat.default)(_urlConsts.IecUrl.iecChannelPointUrl, {
    channelNo: e,
    pointType: t
  });
  return (0, _request.commonDelete)(n);
};

exports.deleteIecChannelPoint = deleteIecChannelPoint;

var downloadIecTmpl = function() {
  var e = document.createElement("a");
  e.href = _urlConsts.IecUrl.iecDownloadIecTmplUrl, e.click();
};

exports.downloadIecTmpl = downloadIecTmpl;