var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Node } from '../../core/models/Node';
import { Server } from '../../core/models/common/Server';
/**
 * Constructor.
 * @param {Node} parent
 * @param {string} name
 * @class
 * @extends Server
 * @author eric.wittmann@gmail.com
 */
var AaiServer = /** @class */ (function (_super) {
    __extends(AaiServer, _super);
    function AaiServer(parent, name) {
        var _this = this;
        if (((parent != null && parent instanceof Node) || parent === null) && ((typeof name === 'string') || name === null)) {
            var __args = arguments;
            {
                var __args_1 = arguments;
                _this = _super.call(this) || this;
                if (_this._name === undefined)
                    _this._name = null;
                if (_this.protocol === undefined)
                    _this.protocol = null;
                if (_this.protocolVersion === undefined)
                    _this.protocolVersion = null;
                if (_this.security === undefined)
                    _this.security = null;
                if (_this.bindings === undefined)
                    _this.bindings = null;
                if (_this._name === undefined)
                    _this._name = null;
                if (_this.protocol === undefined)
                    _this.protocol = null;
                if (_this.protocolVersion === undefined)
                    _this.protocolVersion = null;
                if (_this.security === undefined)
                    _this.security = null;
                if (_this.bindings === undefined)
                    _this.bindings = null;
                (function () {
                    if (parent != null) {
                        _this._parent = parent;
                        _this._ownerDocument = parent.ownerDocument();
                    }
                })();
            }
            (function () {
                _this._name = name;
            })();
        }
        else if (((typeof parent === 'string') || parent === null) && name === undefined) {
            var __args = arguments;
            var name_1 = __args[0];
            _this = _super.call(this) || this;
            if (_this._name === undefined)
                _this._name = null;
            if (_this.protocol === undefined)
                _this.protocol = null;
            if (_this.protocolVersion === undefined)
                _this.protocolVersion = null;
            if (_this.security === undefined)
                _this.security = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            if (_this._name === undefined)
                _this._name = null;
            if (_this.protocol === undefined)
                _this.protocol = null;
            if (_this.protocolVersion === undefined)
                _this.protocolVersion = null;
            if (_this.security === undefined)
                _this.security = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            (function () {
                _this._name = name_1;
            })();
        }
        else if (((parent != null && parent instanceof Node) || parent === null) && name === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this._name === undefined)
                _this._name = null;
            if (_this.protocol === undefined)
                _this.protocol = null;
            if (_this.protocolVersion === undefined)
                _this.protocolVersion = null;
            if (_this.security === undefined)
                _this.security = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            if (_this._name === undefined)
                _this._name = null;
            if (_this.protocol === undefined)
                _this.protocol = null;
            if (_this.protocolVersion === undefined)
                _this.protocolVersion = null;
            if (_this.security === undefined)
                _this.security = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            (function () {
                if (parent != null) {
                    _this._parent = parent;
                    _this._ownerDocument = parent.ownerDocument();
                }
            })();
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.Node#accept(IVisitor)
     * @param {*} visitor
     */
    AaiServer.prototype.accept = function (visitor) {
        var viz = visitor;
        viz.visitServer(this);
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.INamed#getName()
     * @return {string}
     */
    AaiServer.prototype.getName = function () {
        return this._name;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.INamed#rename(java.lang.String)
     * @param {string} newName
     */
    AaiServer.prototype.rename = function (newName) {
        this._name = newName;
    };
    /**
     * Adds a security requirement child.
     *
     * @param {AaiSecurityRequirement} securityRequirement
     * @return {AaiSecurityRequirement}
     */
    AaiServer.prototype.addSecurityRequirement = function (securityRequirement) {
        if (this.security == null) {
            this.security = ([]);
        }
        /* add */ (this.security.push(securityRequirement) > 0);
        return securityRequirement;
    };
    return AaiServer;
}(Server));
export { AaiServer };
AaiServer["__class"] = "io.apicurio.datamodels.asyncapi.models.AaiServer";
AaiServer["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.common.INamed"];
//# sourceMappingURL=AaiServer.js.map