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 { ExtensibleNode } from '../../core/models/ExtensibleNode';
/**
 * Modles the OpenAPI paths.
 * @author eric.wittmann@gmail.com
 * @class
 * @extends ExtensibleNode
 */
var OasPaths = /** @class */ (function (_super) {
    __extends(OasPaths, _super);
    function OasPaths() {
        var _this = _super.call(this) || this;
        _this._pathItems = ({});
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.Node#accept(io.apicurio.datamodels.core.visitors.IVisitor)
     * @param {*} visitor
     */
    OasPaths.prototype.accept = function (visitor) {
        var oasVisitor = visitor;
        oasVisitor.visitPaths(this);
    };
    /**
     * Returns a single path item by name.
     * @param {string} name
     * @return {OasPathItem}
     */
    OasPaths.prototype.getPathItem = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this._pathItems, name);
    };
    /**
     * Returns an array of all the path items.
     * @return {OasPathItem[]}
     */
    OasPaths.prototype.getPathItems = function () {
        var rval = ([]);
        /* 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._pathItems));
        return rval;
    };
    /**
     * Adds a path item.
     * @param {string} name
     * @param {OasPathItem} pathItem
     * @return {OasPathItem}
     */
    OasPaths.prototype.addPathItem = function (name, pathItem) {
        /* put */ (this._pathItems[name] = pathItem);
        return pathItem;
    };
    /**
     * Gets a list of all the path names.
     * @return {string[]}
     */
    OasPaths.prototype.getPathItemNames = function () {
        var names = ([]);
        /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(names, /* keySet */ Object.keys(this._pathItems));
        return names;
    };
    /**
     * Removes a single path item child model by name.
     * @param {string} path
     * @return {OasPathItem}
     */
    OasPaths.prototype.removePathItem = function (path) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this._pathItems[path]; delete _this._pathItems[path]; return deleted; })(this._pathItems);
    };
    OasPaths.prototype.addItem$java_lang_String$io_apicurio_datamodels_openapi_models_OasPathItem = function (name, item) {
        this.addPathItem(name, item);
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#addItem(java.lang.String, io.apicurio.datamodels.core.models.Node)
     * @param {string} name
     * @param {OasPathItem} item
     */
    OasPaths.prototype.addItem = function (name, item) {
        if (((typeof name === 'string') || name === null) && ((item != null && item instanceof OasPathItem) || item === null)) {
            return this.addItem$java_lang_String$io_apicurio_datamodels_openapi_models_OasPathItem(name, item);
        }
        else
            throw new Error('invalid overload');
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#deleteItem(java.lang.String)
     * @param {string} name
     * @return {OasPathItem}
     */
    OasPaths.prototype.deleteItem = function (name) {
        return this.removePathItem(name);
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItem(java.lang.String)
     * @param {string} name
     * @return {OasPathItem}
     */
    OasPaths.prototype.getItem = function (name) {
        return this.getPathItem(name);
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItemNames()
     * @return {string[]}
     */
    OasPaths.prototype.getItemNames = function () {
        return this.getPathItemNames();
    };
    /**
     * @see io.apicurio.datamodels.core.models.IIndexedNode#getItems()
     * @return {OasPathItem[]}
     */
    OasPaths.prototype.getItems = function () {
        return this.getPathItems();
    };
    return OasPaths;
}(ExtensibleNode));
export { OasPaths };
OasPaths["__class"] = "io.apicurio.datamodels.openapi.models.OasPaths";
OasPaths["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IIndexedNode"];
import { OasPathItem } from './OasPathItem';
//# sourceMappingURL=OasPaths.js.map