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 __());
    };
})();
/* Generated from Java with JSweet 2.3.7 - http://www.jsweet.org */
import { Node } from '../Node';
/**
 * Constructor.
 * @class
 * @extends Node
 * @author eric.wittmann@gmail.com
 */
var SecurityRequirement = /** @class */ (function (_super) {
    __extends(SecurityRequirement, _super);
    function SecurityRequirement() {
        var _this = _super.call(this) || this;
        _this._items = ({});
        return _this;
    }
    /**
     * Gets the names of all the security requirements.
     * @return {string[]}
     */
    SecurityRequirement.prototype.getSecurityRequirementNames = function () {
        var rval = ([]);
        /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(rval, /* keySet */ Object.keys(this._items));
        return rval;
    };
    /**
     * Gets the scopes defined for this security requirement.  This is only valid if the
     * type of security is oauth2.
     * @param {string} name
     * @return {string[]}
     */
    SecurityRequirement.prototype.getScopes = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this._items, name);
    };
    /**
     * Adds a security requirement item.
     * @param {string} name
     * @param {string[]} scopes
     */
    SecurityRequirement.prototype.addSecurityRequirementItem = function (name, scopes) {
        if (scopes == null) {
            scopes = /* emptyList */ [];
        }
        /* put */ (this._items[name] = scopes);
    };
    /**
     * Removes a single security requirement item (reference to an existing security scheme)
     * by scheme name and returns the array of scopes previously mapped to the scheme name.
     * @param {string} name
     * @return {string[]}
     */
    SecurityRequirement.prototype.removeSecurityRequirementItem = function (name) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this._items[name]; delete _this._items[name]; return deleted; })(this._items);
    };
    /**
     * @see io.apicurio.datamodels.core.models.Node#accept(io.apicurio.datamodels.core.visitors.IVisitor)
     * @param {*} visitor
     */
    SecurityRequirement.prototype.accept = function (visitor) {
        visitor.visitSecurityRequirement(this);
    };
    return SecurityRequirement;
}(Node));
export { SecurityRequirement };
SecurityRequirement["__class"] = "io.apicurio.datamodels.core.models.common.SecurityRequirement";
SecurityRequirement["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable"];
//# sourceMappingURL=SecurityRequirement.js.map