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';
/**
 * Constructor.
 * @class
 * @extends Node
 * @author eric.wittmann@gmail.com
 */
var Oas20SecurityDefinitions = /** @class */ (function (_super) {
    __extends(Oas20SecurityDefinitions, _super);
    function Oas20SecurityDefinitions() {
        var _this = _super.call(this) || this;
        if (_this.items === undefined)
            _this.items = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.Node#accept(io.apicurio.datamodels.core.visitors.IVisitor)
     * @param {*} visitor
     */
    Oas20SecurityDefinitions.prototype.accept = function (visitor) {
        var viz = visitor;
        viz.visitSecurityDefinitions(this);
    };
    /**
     * Gets a list of all the security scheme names.
     * @return {string[]}
     */
    Oas20SecurityDefinitions.prototype.getSecuritySchemeNames = function () {
        var rval = ([]);
        if (this.items != null) {
            /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(rval, /* keySet */ Object.keys(this.items));
        }
        return rval;
    };
    /**
     * Returns a single security scheme by name.
     * @param {string} name
     * @return {Oas20SecurityScheme}
     */
    Oas20SecurityDefinitions.prototype.getSecurityScheme = function (name) {
        if (this.items != null) {
            return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.items, name);
        }
        return null;
    };
    /**
     * Returns an array of all the security schemes.
     * @return {Oas20SecurityScheme[]}
     */
    Oas20SecurityDefinitions.prototype.getSecuritySchemes = function () {
        var rval = ([]);
        if (this.items != null) {
            /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(rval, /* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.items));
        }
        return rval;
    };
    /**
     * Adds a security scheme child node.
     * @param {string} name
     * @param {Oas20SecurityScheme} scheme
     */
    Oas20SecurityDefinitions.prototype.addSecurityScheme = function (name, scheme) {
        if (this.items == null) {
            this.items = ({});
        }
        /* put */ (this.items[name] = scheme);
    };
    /**
     * Removes a single security scheme by name.
     * @param {string} name
     * @return {Oas20SecurityScheme}
     */
    Oas20SecurityDefinitions.prototype.removeSecurityScheme = function (name) {
        var _this = this;
        if (this.items != null) {
            return /* remove */ (function (map) { var deleted = _this.items[name]; delete _this.items[name]; return deleted; })(this.items);
        }
        return null;
    };
    /**
     * Creates a child security scheme object and adds it to the list.
     * @param {string} name
     * @return {Oas20SecurityScheme}
     */
    Oas20SecurityDefinitions.prototype.createSecurityScheme = function (name) {
        var rval = new Oas20SecurityScheme(name);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItem(java.lang.String)
     * @param {string} name
     * @return {Oas20SecurityScheme}
     */
    Oas20SecurityDefinitions.prototype.getItem = function (name) {
        return this.getSecurityScheme(name);
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItems()
     * @return {Oas20SecurityScheme[]}
     */
    Oas20SecurityDefinitions.prototype.getItems = function () {
        return this.getSecuritySchemes();
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItemNames()
     * @return {string[]}
     */
    Oas20SecurityDefinitions.prototype.getItemNames = function () {
        return this.getItemNames();
    };
    Oas20SecurityDefinitions.prototype.addItem$java_lang_String$io_apicurio_datamodels_openapi_v2_models_Oas20SecurityScheme = function (name, item) {
        this.addSecurityScheme(name, item);
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#addItem(java.lang.String, io.apicurio.datamodels.core.models.Node)
     * @param {string} name
     * @param {Oas20SecurityScheme} item
     */
    Oas20SecurityDefinitions.prototype.addItem = function (name, item) {
        if (((typeof name === 'string') || name === null) && ((item != null && item instanceof Oas20SecurityScheme) || item === null)) {
            return this.addItem$java_lang_String$io_apicurio_datamodels_openapi_v2_models_Oas20SecurityScheme(name, item);
        }
        else
            throw new Error('invalid overload');
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#deleteItem(java.lang.String)
     * @param {string} name
     * @return {Oas20SecurityScheme}
     */
    Oas20SecurityDefinitions.prototype.deleteItem = function (name) {
        return this.removeSecurityScheme(name);
    };
    return Oas20SecurityDefinitions;
}(Node));
export { Oas20SecurityDefinitions };
Oas20SecurityDefinitions["__class"] = "io.apicurio.datamodels.openapi.v2.models.Oas20SecurityDefinitions";
Oas20SecurityDefinitions["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IIndexedNode"];
import { Oas20SecurityScheme } from './Oas20SecurityScheme';
//# sourceMappingURL=Oas20SecurityDefinitions.js.map