"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _TenantAwareModel = _interopRequireDefault(require("../../../common/v1/config/TenantAwareModel"));
var _ExternalizableAbstractModel = _interopRequireDefault(require("../../../common/v1/response/ExternalizableAbstractModel"));
var _FloatingIPAddress = _interopRequireDefault(require("./FloatingIPAddress"));
var _LoadBalancerSessionAssociation = _interopRequireDefault(require("./LoadBalancerSessionAssociation"));
var _NetworkingBaseModel2 = _interopRequireDefault(require("./NetworkingBaseModel"));
var _PrivateIpAssociation = _interopRequireDefault(require("./PrivateIpAssociation"));
var _Subnet = _interopRequireDefault(require("./Subnet"));
var _VmNic = _interopRequireDefault(require("./VmNic"));
var _VmNicAssociation = _interopRequireDefault(require("./VmNicAssociation"));
var _Vpc = _interopRequireDefault(require("./Vpc"));
var _ValidationScopes = _interopRequireDefault(require("../../../validation/ValidationScopes"));
var _ValidationUtils = _interopRequireDefault(require("../../../../utils/ValidationUtils"));
var _ValidationError = _interopRequireDefault(require("../../../validation/ValidationError"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /*
 * Nutanix Networking APIs
 *
 * OpenAPI spec version: 4.0.1
 *
 * NOTE: This class is auto generated by the Open API Dev Platform.
 *
 * Open API Dev Platform Codegen version: 16.9.0.8546-RELEASE
 *
 * Do not edit the class manually.
 *
 */
/**
 * The FloatingIp model module.
 * @module Ntnx/FloatingIp
 * @version 4.0.1
 * @class FloatingIp
 * @extends NetworkingBaseModel
 * 
 * @param { string } name Name of the floating IP.
 */
var _FloatingIp_brand = /*#__PURE__*/new WeakSet();
var FloatingIp = exports["default"] = /*#__PURE__*/function (_NetworkingBaseModel) {
  /**
   * Constructs a new <code>FloatingIp</code>.
   * Configure a floating IP.
   * @alias module:Ntnx/FloatingIp
   * @extends module:Ntnx/NetworkingBaseModel
   * 
   * @param { string } name Name of the floating IP.
  */
  function FloatingIp(name) {
    var _this;
    _classCallCheck(this, FloatingIp);
    _this = _callSuper(this, FloatingIp);
    /*
    * toJson method for a map type which supports map with primitive keys and values of object types
    * @param {Object} obj
    * @returns {Object|Map} Returns a new transofrmed Map by calling toJson on the values if applicable.
    * Otherwise, just returns the input object.
    */
    _classPrivateMethodInitSpec(_this, _FloatingIp_brand);
    _this.name = name;
    _this.$objectType = "networking.v4.config.FloatingIp";
    /** @type {object<string, any>} */
    _this.$reserved = {
      '$fv': "v4.r0"
    };
    /** @type {object<string, any>} */
    _this.$unknownFields = {};
    return _this;
  }

  /**
   * Constructs a <code>FloatingIp</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {module:Ntnx/FloatingIp} obj Optional instance to populate.
   * @param callFromChild {Boolean} Flag to recognise calling instance
   * @return {module:Ntnx/FloatingIp} The populated <code>FloatingIp</code> instance.
   */
  _inherits(FloatingIp, _NetworkingBaseModel);
  return _createClass(FloatingIp, [{
    key: "getName",
    value:
    /**
     * Returns Name of the floating IP.
     * @return {string}
     */
    function getName() {
      return this.name;
    }

    /**
     * Sets Name of the floating IP.
     * @param {string} name Name of the floating IP.
     */
  }, {
    key: "setName",
    value: function setName(name) {
      this.name = name;
    }

    /**
     * Returns Description for the Floating IP.
     * @return {string}
     */
  }, {
    key: "getDescription",
    value: function getDescription() {
      return this.description;
    }

    /**
     * Sets Description for the Floating IP.
     * @param {string} description Description for the Floating IP.
     */
  }, {
    key: "setDescription",
    value: function setDescription(description) {
      this.description = description;
    }

    /**
     * Returns Association of the Floating IP with either NIC or Private IP
     * @return {VmNicAssociation | PrivateIpAssociation | LoadBalancerSessionAssociation}
     */
  }, {
    key: "getAssociation",
    value: function getAssociation() {
      return this.association;
    }

    /**
     * Sets Association of the Floating IP with either NIC or Private IP
     * @param {VmNicAssociation | PrivateIpAssociation | LoadBalancerSessionAssociation} association Association of the Floating IP with either NIC or Private IP
     */
  }, {
    key: "setAssociation",
    value: function setAssociation(association) {
      this.association = association;
    }

    /**
     * @return {FloatingIPAddress}
     */
  }, {
    key: "getFloatingIp",
    value: function getFloatingIp() {
      return this.floatingIp;
    }

    /**
     * @param {FloatingIPAddress} floatingIp
     */
  }, {
    key: "setFloatingIp",
    value: function setFloatingIp(floatingIp) {
      this.floatingIp = floatingIp;
    }

    /**
     * Returns External subnet reference for the Floating IP to be allocated in on-prem only.
     * @return {string}
     */
  }, {
    key: "getExternalSubnetReference",
    value: function getExternalSubnetReference() {
      return this.externalSubnetReference;
    }

    /**
     * Sets External subnet reference for the Floating IP to be allocated in on-prem only.
     * @param {string} externalSubnetReference External subnet reference for the Floating IP to be allocated in on-prem only.
     */
  }, {
    key: "setExternalSubnetReference",
    value: function setExternalSubnetReference(externalSubnetReference) {
      this.externalSubnetReference = externalSubnetReference;
    }

    /**
     * @return {Subnet}
     */
  }, {
    key: "getExternalSubnet",
    value: function getExternalSubnet() {
      return this.externalSubnet;
    }

    /**
     * @param {Subnet} externalSubnet
     */
  }, {
    key: "setExternalSubnet",
    value: function setExternalSubnet(externalSubnet) {
      this.externalSubnet = externalSubnet;
    }

    /**
     * Returns Private IP value in string
     * @return {string}
     */
  }, {
    key: "getPrivateIp",
    value: function getPrivateIp() {
      return this.privateIp;
    }

    /**
     * Sets Private IP value in string
     * @param {string} privateIp Private IP value in string
     */
  }, {
    key: "setPrivateIp",
    value: function setPrivateIp(privateIp) {
      this.privateIp = privateIp;
    }

    /**
     * Returns Floating IP value in string
     * @return {string}
     */
  }, {
    key: "getFloatingIpValue",
    value: function getFloatingIpValue() {
      return this.floatingIpValue;
    }

    /**
     * Sets Floating IP value in string
     * @param {string} floatingIpValue Floating IP value in string
     */
  }, {
    key: "setFloatingIpValue",
    value: function setFloatingIpValue(floatingIpValue) {
      this.floatingIpValue = floatingIpValue;
    }

    /**
     * Returns Association status of floating IP.
     * @return {string}
     */
  }, {
    key: "getAssociationStatus",
    value: function getAssociationStatus() {
      return this.associationStatus;
    }

    /**
     * Sets Association status of floating IP.
     * @param {string} associationStatus Association status of floating IP.
     */
  }, {
    key: "setAssociationStatus",
    value: function setAssociationStatus(associationStatus) {
      this.associationStatus = associationStatus;
    }

    /**
     * Returns VPC reference UUID
     * @return {string}
     */
  }, {
    key: "getVpcReference",
    value: function getVpcReference() {
      return this.vpcReference;
    }

    /**
     * Sets VPC reference UUID
     * @param {string} vpcReference VPC reference UUID
     */
  }, {
    key: "setVpcReference",
    value: function setVpcReference(vpcReference) {
      this.vpcReference = vpcReference;
    }

    /**
     * Returns VM NIC reference.
     * @return {string}
     */
  }, {
    key: "getVmNicReference",
    value: function getVmNicReference() {
      return this.vmNicReference;
    }

    /**
     * Sets VM NIC reference.
     * @param {string} vmNicReference VM NIC reference.
     */
  }, {
    key: "setVmNicReference",
    value: function setVmNicReference(vmNicReference) {
      this.vmNicReference = vmNicReference;
    }

    /**
     * Returns Load Balancer Session reference UUID.
     * @return {string}
     */
  }, {
    key: "getLoadBalancerSessionReference",
    value: function getLoadBalancerSessionReference() {
      return this.loadBalancerSessionReference;
    }

    /**
     * Sets Load Balancer Session reference UUID.
     * @param {string} loadBalancerSessionReference Load Balancer Session reference UUID.
     */
  }, {
    key: "setLoadBalancerSessionReference",
    value: function setLoadBalancerSessionReference(loadBalancerSessionReference) {
      this.loadBalancerSessionReference = loadBalancerSessionReference;
    }

    /**
     * @return {Vpc}
     */
  }, {
    key: "getVpc",
    value: function getVpc() {
      return this.vpc;
    }

    /**
     * @param {Vpc} vpc
     */
  }, {
    key: "setVpc",
    value: function setVpc(vpc) {
      this.vpc = vpc;
    }

    /**
     * @return {VmNic}
     */
  }, {
    key: "getVmNic",
    value: function getVmNic() {
      return this.vmNic;
    }

    /**
     * @param {VmNic} vmNic
     */
  }, {
    key: "setVmNic",
    value: function setVmNic(vmNic) {
      this.vmNic = vmNic;
    }
  }, {
    key: "toJson",
    value: function toJson(forMutation) {
      if (forMutation === false) {
        return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof this.getName() !== 'undefined' && this.getName() !== null ? {
          'name': this.getName()
        } : {}), typeof this.getDescription() !== 'undefined' && this.getDescription() !== null ? {
          'description': this.getDescription()
        } : {}), typeof this.getAssociation() !== 'undefined' && this.getAssociation() !== null ? {
          'association': typeof this.getAssociation().toJson !== "undefined" ? this.getAssociation().toJson(false) : Array.isArray(this.getAssociation()) ? this.getAssociation().map(function (item) {
            return typeof item.toJson !== "undefined" ? item.toJson(false) : item;
          }) : _assertClassBrand(_FloatingIp_brand, this, _toJsonMapType).call(this, this.getAssociation(), false)
        } : {}), typeof this.getFloatingIp() !== 'undefined' && this.getFloatingIp() !== null ? {
          'floatingIp': this.getFloatingIp().toJson(false)
        } : {}), typeof this.getExternalSubnetReference() !== 'undefined' && this.getExternalSubnetReference() !== null ? {
          'externalSubnetReference': this.getExternalSubnetReference()
        } : {}), typeof this.getExternalSubnet() !== 'undefined' && this.getExternalSubnet() !== null ? {
          'externalSubnet': this.getExternalSubnet().toJson(false)
        } : {}), typeof this.getPrivateIp() !== 'undefined' && this.getPrivateIp() !== null ? {
          'privateIp': this.getPrivateIp()
        } : {}), typeof this.getFloatingIpValue() !== 'undefined' && this.getFloatingIpValue() !== null ? {
          'floatingIpValue': this.getFloatingIpValue()
        } : {}), typeof this.getAssociationStatus() !== 'undefined' && this.getAssociationStatus() !== null ? {
          'associationStatus': this.getAssociationStatus()
        } : {}), typeof this.getVpcReference() !== 'undefined' && this.getVpcReference() !== null ? {
          'vpcReference': this.getVpcReference()
        } : {}), typeof this.getVmNicReference() !== 'undefined' && this.getVmNicReference() !== null ? {
          'vmNicReference': this.getVmNicReference()
        } : {}), typeof this.getLoadBalancerSessionReference() !== 'undefined' && this.getLoadBalancerSessionReference() !== null ? {
          'loadBalancerSessionReference': this.getLoadBalancerSessionReference()
        } : {}), typeof this.getVpc() !== 'undefined' && this.getVpc() !== null ? {
          'vpc': this.getVpc().toJson(false)
        } : {}), typeof this.getVmNic() !== 'undefined' && this.getVmNic() !== null ? {
          'vmNic': this.getVmNic().toJson(false)
        } : {}), typeof this.getMetadata() !== 'undefined' && this.getMetadata() !== null ? {
          'metadata': this.getMetadata().toJson(false)
        } : {}), typeof this.getExtId() !== 'undefined' && this.getExtId() !== null ? {
          'extId': this.getExtId()
        } : {}), typeof this.getLinks() !== 'undefined' && this.getLinks() !== null ? {
          'links': this.getLinks().map(function (item) {
            return item.toJson(false);
          })
        } : {}), typeof this.getTenantId() !== 'undefined' && this.getTenantId() !== null ? {
          'tenantId': this.getTenantId()
        } : {}), {}, {
          '$reserved': this.get$Reserved(),
          '$objectType': this.get$ObjectType(),
          '$unknownFields': this.get$UnknownFields()
        });
      }
      return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof this.getName() !== 'undefined' && this.getName() !== null ? {
        'name': this.getName()
      } : {}), typeof this.getDescription() !== 'undefined' && this.getDescription() !== null ? {
        'description': this.getDescription()
      } : {}), typeof this.getAssociation() !== 'undefined' && this.getAssociation() !== null ? {
        'association': typeof this.getAssociation().toJson !== "undefined" ? this.getAssociation().toJson() : Array.isArray(this.getAssociation()) ? this.getAssociation().map(function (item) {
          return typeof item.toJson !== "undefined" ? item.toJson() : item;
        }) : _assertClassBrand(_FloatingIp_brand, this, _toJsonMapType).call(this, this.getAssociation())
      } : {}), typeof this.getFloatingIp() !== 'undefined' && this.getFloatingIp() !== null ? {
        'floatingIp': this.getFloatingIp().toJson(false)
      } : {}), typeof this.getExternalSubnetReference() !== 'undefined' && this.getExternalSubnetReference() !== null ? {
        'externalSubnetReference': this.getExternalSubnetReference()
      } : {}), typeof this.getExternalSubnet() !== 'undefined' && this.getExternalSubnet() !== null ? {
        'externalSubnet': this.getExternalSubnet().toJson(false)
      } : {}), typeof this.getVpcReference() !== 'undefined' && this.getVpcReference() !== null ? {
        'vpcReference': this.getVpcReference()
      } : {}), typeof this.getVmNicReference() !== 'undefined' && this.getVmNicReference() !== null ? {
        'vmNicReference': this.getVmNicReference()
      } : {}), typeof this.getLoadBalancerSessionReference() !== 'undefined' && this.getLoadBalancerSessionReference() !== null ? {
        'loadBalancerSessionReference': this.getLoadBalancerSessionReference()
      } : {}), typeof this.getVpc() !== 'undefined' && this.getVpc() !== null ? {
        'vpc': this.getVpc().toJson(false)
      } : {}), typeof this.getVmNic() !== 'undefined' && this.getVmNic() !== null ? {
        'vmNic': this.getVmNic().toJson(false)
      } : {}), typeof this.getMetadata() !== 'undefined' && this.getMetadata() !== null ? {
        'metadata': this.getMetadata().toJson(false)
      } : {}), {}, {
        '$reserved': this.get$Reserved(),
        '$objectType': this.get$ObjectType(),
        '$unknownFields': this.get$UnknownFields()
      });
    }
  }, {
    key: "validate",
    value: function validate(scope, properties) {
      var _this2 = this;
      var propList = [];
      if (arguments.length === 0 || arguments.length === 1 && arguments[0] instanceof _ValidationScopes["default"]) {
        //cases validate() and validate(scope)
        propList = ["name"];
      } else if (arguments.length === 1) {
        //case validate(properties)
        propList = arguments[0];
        scope = null;
      } else {
        //case validate(scope, properties)
        propList = arguments[1];
      }
      var res = [];
      var err = null;
      propList.forEach(function (property) {
        err = _this2.validateProperty(property, scope);
        if (err) {
          res.push(err);
        }
      });
      return new Promise(function (resolve, reject) {
        if (res.length !== 0) {
          reject(err);
        } else {
          resolve();
        }
      });
    }
  }, {
    key: "validateProperty",
    value: function validateProperty(scope, property) {
      if (property === "name") {
        if (typeof this.name === 'undefined' || this.name === null) {
          return new _ValidationError["default"]("name", "undefined or null");
        }
        if (!_ValidationUtils["default"].validateMaxLength(this.name, 128)) {
          return new _ValidationError["default"]("name", "does not satisfy required maxLength constraint: 128");
        }
      }
      if (property === "description") {
        if (typeof this.description === 'undefined' || this.description === null) {
          return new _ValidationError["default"]("description", "undefined or null");
        }
        if (!_ValidationUtils["default"].validateMaxLength(this.description, 1000)) {
          return new _ValidationError["default"]("description", "does not satisfy required maxLength constraint: 1000");
        }
      }
      if (property === "association") {
        if (typeof this.association === 'undefined' || this.association === null) {
          return new _ValidationError["default"]("association", "undefined or null");
        }
      }
      if (property === "floatingIp") {
        if (typeof this.floatingIp === 'undefined' || this.floatingIp === null) {
          return new _ValidationError["default"]("floatingIp", "undefined or null");
        }
      }
      if (property === "externalSubnetReference") {
        if (typeof this.externalSubnetReference === 'undefined' || this.externalSubnetReference === null) {
          return new _ValidationError["default"]("externalSubnetReference", "undefined or null");
        }
        if (!_ValidationUtils["default"].validatePattern(this.externalSubnetReference, /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)) {
          return new _ValidationError["default"]("externalSubnetReference", "does not satisfy required pattern: /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/");
        }
      }
      if (property === "externalSubnet") {
        if (typeof this.externalSubnet === 'undefined' || this.externalSubnet === null) {
          return new _ValidationError["default"]("externalSubnet", "undefined or null");
        }
      }
      if (property === "privateIp") {
        if (typeof this.privateIp === 'undefined' || this.privateIp === null) {
          return new _ValidationError["default"]("privateIp", "undefined or null");
        }
      }
      if (property === "floatingIpValue") {
        if (typeof this.floatingIpValue === 'undefined' || this.floatingIpValue === null) {
          return new _ValidationError["default"]("floatingIpValue", "undefined or null");
        }
      }
      if (property === "associationStatus") {
        if (typeof this.associationStatus === 'undefined' || this.associationStatus === null) {
          return new _ValidationError["default"]("associationStatus", "undefined or null");
        }
      }
      if (property === "vpcReference") {
        if (typeof this.vpcReference === 'undefined' || this.vpcReference === null) {
          return new _ValidationError["default"]("vpcReference", "undefined or null");
        }
        if (!_ValidationUtils["default"].validatePattern(this.vpcReference, /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)) {
          return new _ValidationError["default"]("vpcReference", "does not satisfy required pattern: /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/");
        }
      }
      if (property === "vmNicReference") {
        if (typeof this.vmNicReference === 'undefined' || this.vmNicReference === null) {
          return new _ValidationError["default"]("vmNicReference", "undefined or null");
        }
        if (!_ValidationUtils["default"].validatePattern(this.vmNicReference, /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)) {
          return new _ValidationError["default"]("vmNicReference", "does not satisfy required pattern: /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/");
        }
      }
      if (property === "loadBalancerSessionReference") {
        if (typeof this.loadBalancerSessionReference === 'undefined' || this.loadBalancerSessionReference === null) {
          return new _ValidationError["default"]("loadBalancerSessionReference", "undefined or null");
        }
        if (!_ValidationUtils["default"].validatePattern(this.loadBalancerSessionReference, /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)) {
          return new _ValidationError["default"]("loadBalancerSessionReference", "does not satisfy required pattern: /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/");
        }
      }
      if (property === "vpc") {
        if (typeof this.vpc === 'undefined' || this.vpc === null) {
          return new _ValidationError["default"]("vpc", "undefined or null");
        }
      }
      if (property === "vmNic") {
        if (typeof this.vmNic === 'undefined' || this.vmNic === null) {
          return new _ValidationError["default"]("vmNic", "undefined or null");
        }
      }
      return new _ValidationError["default"](property, "no such property exists");
    }
  }], [{
    key: "constructFromObject",
    value: function constructFromObject(data) {
      var obj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var callFromChild = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      var items, item, i, itemArr, discriminator;
      if (data) {
        obj = obj || new FloatingIp();
        _NetworkingBaseModel2["default"].constructFromObject(data, obj, true);
        if (data.hasOwnProperty('name') && data.name !== null && data.name !== undefined) {
          obj.setName(data['name']);
        }
        if (data.hasOwnProperty('description') && data.description !== null && data.description !== undefined) {
          obj.setDescription(data['description']);
        }
        if (data.hasOwnProperty('association') && data.association !== null && data.association !== undefined) {
          if (data['association'].hasOwnProperty('$objectType')) {
            discriminator = data['association']['$objectType'];
          } else {
            discriminator = _typeof(data['association']);
          }
          switch (discriminator) {
            case 'networking.v4.config.VmNicAssociation':
              obj.setAssociation(_VmNicAssociation["default"].constructFromObject(data['association'], undefined));
              break;
            case 'networking.v4.config.PrivateIpAssociation':
              obj.setAssociation(_PrivateIpAssociation["default"].constructFromObject(data['association'], undefined));
              break;
            case 'networking.v4.config.LoadBalancerSessionAssociation':
              obj.setAssociation(_LoadBalancerSessionAssociation["default"].constructFromObject(data['association'], undefined));
              break;
            default:
              throw "Unknown datatype " + discriminator + " in data";
          }
        }
        if (data.hasOwnProperty('floatingIp') && data.floatingIp !== null && data.floatingIp !== undefined) {
          obj.setFloatingIp(_FloatingIPAddress["default"].constructFromObject(data['floatingIp']));
        }
        if (data.hasOwnProperty('externalSubnetReference') && data.externalSubnetReference !== null && data.externalSubnetReference !== undefined) {
          obj.setExternalSubnetReference(data['externalSubnetReference']);
        }
        if (data.hasOwnProperty('externalSubnet') && data.externalSubnet !== null && data.externalSubnet !== undefined) {
          obj.setExternalSubnet(_Subnet["default"].constructFromObject(data['externalSubnet']));
        }
        if (data.hasOwnProperty('privateIp') && data.privateIp !== null && data.privateIp !== undefined) {
          obj.setPrivateIp(data['privateIp']);
        }
        if (data.hasOwnProperty('floatingIpValue') && data.floatingIpValue !== null && data.floatingIpValue !== undefined) {
          obj.setFloatingIpValue(data['floatingIpValue']);
        }
        if (data.hasOwnProperty('associationStatus') && data.associationStatus !== null && data.associationStatus !== undefined) {
          obj.setAssociationStatus(data['associationStatus']);
        }
        if (data.hasOwnProperty('vpcReference') && data.vpcReference !== null && data.vpcReference !== undefined) {
          obj.setVpcReference(data['vpcReference']);
        }
        if (data.hasOwnProperty('vmNicReference') && data.vmNicReference !== null && data.vmNicReference !== undefined) {
          obj.setVmNicReference(data['vmNicReference']);
        }
        if (data.hasOwnProperty('loadBalancerSessionReference') && data.loadBalancerSessionReference !== null && data.loadBalancerSessionReference !== undefined) {
          obj.setLoadBalancerSessionReference(data['loadBalancerSessionReference']);
        }
        if (data.hasOwnProperty('vpc') && data.vpc !== null && data.vpc !== undefined) {
          obj.setVpc(_Vpc["default"].constructFromObject(data['vpc']));
        }
        if (data.hasOwnProperty('vmNic') && data.vmNic !== null && data.vmNic !== undefined) {
          obj.setVmNic(_VmNic["default"].constructFromObject(data['vmNic']));
        }
        if (!callFromChild) {
          obj.$unknownFields = _objectSpread({}, data.$unknownFields);
          for (var property in data) {
            // Check if the `property` is not already present in `obj` keys, either in snake_case or camelCase,
            // as the model's fields are generated in camelCase, but the server might return snake_case (e.g., due to standards like OIDC).
            // Also, ensure the `property` does not start with '$' and end with 'ItemDiscriminator'.
            // If all conditions are true, add the `property` from `data` to `obj.$unknownFields` as an unknown field.
            if (!Object.keys(obj).includes(property) && !Object.keys(obj).includes(this.snakeToCamel(property)) && !(property[0] === "$" && property.endsWith("ItemDiscriminator"))) {
              obj.$unknownFields[property] = data[property];
            }
          }
        }
      }
      return obj;
    }

    /**
    * Converts a given snake_case string to camelCase.
    * @param {string} snakeStr - The input string in snake_case format.
    * @returns {string} - The converted string in camelCase format.
    */
  }, {
    key: "snakeToCamel",
    value: function snakeToCamel(snakeStr) {
      return snakeStr.replace(/(_\w)/g, function (match) {
        return match[1].toUpperCase();
      });
    }
  }]);
}(_NetworkingBaseModel2["default"]);
/**
 * Name of the floating IP.
 * @memberof FloatingIp
 */
function _toJsonMapType(obj, forMutation) {
  if (obj instanceof Map) {
    return Object.fromEntries(Array.from(obj, function (_ref) {
      var _ref2 = _slicedToArray(_ref, 2),
        k = _ref2[0],
        v = _ref2[1];
      return [k, typeof v.toJson !== "undefined" ? v.toJson(forMutation) : v];
    }));
  } else if (_typeof(obj) === 'object' && obj != null && obj.constructor === Object) {
    return Object.fromEntries(Array.from(Object.entries(obj), function (entry) {
      return [entry[0], typeof entry[1].toJson !== "undefined" ? entry[1].toJson(forMutation) : entry[1]];
    }));
  }
  return obj;
}
/*
* toJson method for a date type which serializes a Date object to proper Date or DateTime formatting
* @param {Object} obj Object to serialize
* @param {boolean} isDateOnly Boolean variable to identify Date or DateTime format for serialization
* @returns {Object|string} Returns serialized date object or original input object
*/
function _handleDateType(obj, isDateOnly) {
  if (obj instanceof Date && isDateOnly !== undefined) {
    return isDateOnly ? obj.toISOString().slice(0, 10) : obj.toISOString();
  }
  return obj;
}
FloatingIp.prototype.name = undefined;

/**
 * Description for the Floating IP.
 * @memberof FloatingIp
 */
FloatingIp.prototype.description = undefined;

/**
 * Association of the Floating IP with either NIC or Private IP
 * @memberof FloatingIp
 */
FloatingIp.prototype.association = undefined;

/**
 * @memberof FloatingIp
 */
FloatingIp.prototype.floatingIp = undefined;

/**
 * External subnet reference for the Floating IP to be allocated in on-prem only.
 * @memberof FloatingIp
 */
FloatingIp.prototype.externalSubnetReference = undefined;

/**
 * @memberof FloatingIp
 */
FloatingIp.prototype.externalSubnet = undefined;

/**
 * Private IP value in string
 * @memberof FloatingIp
 */
FloatingIp.prototype.privateIp = undefined;

/**
 * Floating IP value in string
 * @memberof FloatingIp
 */
FloatingIp.prototype.floatingIpValue = undefined;

/**
 * Association status of floating IP.
 * @memberof FloatingIp
 */
FloatingIp.prototype.associationStatus = undefined;

/**
 * VPC reference UUID
 * @memberof FloatingIp
 */
FloatingIp.prototype.vpcReference = undefined;

/**
 * VM NIC reference.
 * @memberof FloatingIp
 */
FloatingIp.prototype.vmNicReference = undefined;

/**
 * Load Balancer Session reference UUID.
 * @memberof FloatingIp
 */
FloatingIp.prototype.loadBalancerSessionReference = undefined;

/**
 * @memberof FloatingIp
 */
FloatingIp.prototype.vpc = undefined;

/**
 * @memberof FloatingIp
 */
FloatingIp.prototype.vmNic = undefined;

/**
  * @memberof FloatingIp
  */
_NetworkingBaseModel2["default"].prototype.metadata = undefined;
/**
  * A globally unique identifier of an instance that is suitable for external consumption. 
  * @memberof FloatingIp
  */
_ExternalizableAbstractModel["default"].prototype.extId = undefined;
/**
  * A HATEOAS style link for the response.  Each link contains a user-friendly name identifying the link and an address for retrieving the particular resource. 
  * @memberof FloatingIp
  */
_ExternalizableAbstractModel["default"].prototype.links = undefined;
/**
  * A globally unique identifier that represents the tenant that owns this entity. The system automatically assigns it, and it and is immutable from an API consumer perspective (some use cases may cause this Id to change - For instance, a use case may require the transfer of ownership of the entity, but these cases are handled automatically on the server). 
  * @memberof FloatingIp
  */
_TenantAwareModel["default"].prototype.tenantId = undefined;
// Implement OneOfnetworking.v4.config.GetFloatingIpApiResponsedata interface: