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 { NodeCompat } from '../../../compat/NodeCompat';
import { Server } from '../../../core/models/common/Server';
import { OasPathItem } from '../../models/OasPathItem';
/**
 * Constructor.
 * @param {string} path
 * @class
 * @extends OasPathItem
 * @author eric.wittmann@gmail.com
 */
var Oas30PathItem = /** @class */ (function (_super) {
    __extends(Oas30PathItem, _super);
    function Oas30PathItem(path) {
        var _this = _super.call(this, path) || this;
        if (_this.summary === undefined)
            _this.summary = null;
        if (_this.description === undefined)
            _this.description = null;
        if (_this.trace === undefined)
            _this.trace = null;
        if (_this.servers === undefined)
            _this.servers = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.openapi.models.OasPathItem#createOperation(java.lang.String)
     * @param {string} method
     * @return {OasOperation}
     */
    Oas30PathItem.prototype.createOperation = function (method) {
        var rval = new Oas30Operation(method);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.OasPathItem#createParameter()
     * @return {OasParameter}
     */
    Oas30PathItem.prototype.createParameter = function () {
        var rval = new Oas30Parameter();
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#createServer()
     * @return {Server}
     */
    Oas30PathItem.prototype.createServer = function () {
        var rval = new Oas30Server();
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    Oas30PathItem.prototype.addServer$io_apicurio_datamodels_openapi_v3_models_Oas30Server = function (server) {
        if (this.servers == null) {
            this.servers = ([]);
        }
        /* add */ (this.servers.push(server) > 0);
    };
    /**
     * Adds a server.
     * @param {Oas30Server} server
     */
    Oas30PathItem.prototype.addServer = function (server) {
        if (((server != null && server instanceof Oas30Server) || server === null)) {
            return this.addServer$io_apicurio_datamodels_openapi_v3_models_Oas30Server(server);
        }
        else if (((server != null && server instanceof Server) || server === null)) {
            return this.addServer$io_apicurio_datamodels_core_models_common_Server(server);
        }
        else
            throw new Error('invalid overload');
    };
    /**
     * Gets the servers.
     * @return {Server[]}
     */
    Oas30PathItem.prototype.getServers = function () {
        return this.servers;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.OasPathItem#setOperation(io.apicurio.datamodels.openapi.models.OasOperation)
     * @param {OasOperation} operation
     */
    Oas30PathItem.prototype.setOperation = function (operation) {
        if (NodeCompat.equals("trace", operation.getMethod())) {
            this.trace = operation;
        }
        else {
            _super.prototype.setOperation.call(this, operation);
        }
    };
    Oas30PathItem.prototype.addServer$io_apicurio_datamodels_core_models_common_Server = function (server) {
        if (this.servers == null) {
            this.servers = ([]);
        }
        /* add */ (this.servers.push(server) > 0);
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#getServer(java.lang.String)
     * @param {string} url
     * @return {Server}
     */
    Oas30PathItem.prototype.getServer = function (url) {
        if (this.servers != null) {
            for (var index201 = 0; index201 < this.servers.length; index201++) {
                var server = this.servers[index201];
                {
                    if (NodeCompat.equals(server.url, url)) {
                        return server;
                    }
                }
            }
        }
        return null;
    };
    return Oas30PathItem;
}(OasPathItem));
export { Oas30PathItem };
Oas30PathItem["__class"] = "io.apicurio.datamodels.openapi.v3.models.Oas30PathItem";
Oas30PathItem["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IReferenceNode", "io.apicurio.datamodels.openapi.models.IOasParameterParent", "io.apicurio.datamodels.core.models.common.IServerParent"];
import { Oas30Server } from './Oas30Server';
import { Oas30Parameter } from './Oas30Parameter';
import { Oas30Operation } from './Oas30Operation';
//# sourceMappingURL=Oas30PathItem.js.map