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 { Constants } from '../../core/Constants';
import { NodePathVisitor } from '../../core/visitors/NodePathVisitor';
/**
 * Constructor.
 * @class
 * @extends NodePathVisitor
 * @author eric.wittmann@gmail.com
 */
var OasNodePathVisitor = /** @class */ (function (_super) {
    __extends(OasNodePathVisitor, _super);
    function OasNodePathVisitor() {
        return _super.call(this) || this;
    }
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitPaths(io.apicurio.datamodels.openapi.models.OasPaths)
     * @param {OasPaths} node
     */
    OasNodePathVisitor.prototype.visitPaths = function (node) {
        this.path.prependSegment(Constants.PROP_PATHS, false);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitPathItem(io.apicurio.datamodels.openapi.models.OasPathItem)
     * @param {OasPathItem} node
     */
    OasNodePathVisitor.prototype.visitPathItem = function (node) {
        this.path.prependSegment(node.getPath(), true);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitResponses(io.apicurio.datamodels.openapi.models.OasResponses)
     * @param {OasResponses} node
     */
    OasNodePathVisitor.prototype.visitResponses = function (node) {
        this.path.prependSegment(Constants.PROP_RESPONSES, false);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitResponse(io.apicurio.datamodels.openapi.models.OasResponse)
     * @param {OasResponse} node
     */
    OasNodePathVisitor.prototype.visitResponse = function (node) {
        if (node.getName() == null) {
            this.path.prependSegment(Constants.PROP_DEFAULT, false);
        }
        else {
            this.path.prependSegment(node.getName(), true);
        }
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitXML(io.apicurio.datamodels.openapi.models.OasXML)
     * @param {OasXML} node
     */
    OasNodePathVisitor.prototype.visitXML = function (node) {
        this.path.prependSegment(Constants.PROP_XML, false);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitAllOfSchema(io.apicurio.datamodels.openapi.models.OasSchema)
     * @param {OasSchema} node
     */
    OasNodePathVisitor.prototype.visitAllOfSchema = function (node) {
        var idx = NodeCompat.indexOf(node, node.parent(), Constants.PROP_ALL_OF);
        if (idx !== -1) {
            this.path.prependSegment(/* valueOf */ new String(idx).toString(), true);
            this.path.prependSegment(Constants.PROP_ALL_OF, false);
        }
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitItemsSchema(io.apicurio.datamodels.openapi.models.OasSchema)
     * @param {OasSchema} node
     */
    OasNodePathVisitor.prototype.visitItemsSchema = function (node) {
        if (node.hasItemsSchemas()) {
            var idx = NodeCompat.indexOf(node, node.parent(), Constants.PROP_ITEMS);
            if (idx !== -1) {
                this.path.prependSegment(/* valueOf */ new String(idx).toString(), true);
                this.path.prependSegment(Constants.PROP_ITEMS, false);
            }
        }
        else {
            this.path.prependSegment(Constants.PROP_ITEMS, false);
        }
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitAdditionalPropertiesSchema(io.apicurio.datamodels.openapi.models.OasSchema)
     * @param {OasSchema} node
     */
    OasNodePathVisitor.prototype.visitAdditionalPropertiesSchema = function (node) {
        this.path.prependSegment(Constants.PROP_ADDITIONAL_PROPERTIES, false);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitPropertySchema(io.apicurio.datamodels.openapi.models.IOasPropertySchema)
     * @param {*} node
     */
    OasNodePathVisitor.prototype.visitPropertySchema = function (node) {
        this.path.prependSegment(node.getPropertyName(), true);
        this.path.prependSegment(Constants.PROP_PROPERTIES, false);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitHeader(io.apicurio.datamodels.openapi.models.OasHeader)
     * @param {OasHeader} node
     */
    OasNodePathVisitor.prototype.visitHeader = function (node) {
        this.path.prependSegment(node.getName(), true);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitResponseDefinition(io.apicurio.datamodels.core.models.common.IDefinition)
     * @param {*} node
     */
    OasNodePathVisitor.prototype.visitResponseDefinition = function (node) {
        this.path.prependSegment(node.getName(), true);
    };
    /**
     * @see io.apicurio.datamodels.openapi.visitors.IOasVisitor#visitExample(io.apicurio.datamodels.core.models.common.IExample)
     * @param {*} node
     */
    OasNodePathVisitor.prototype.visitExample = function (node) {
        throw Object.defineProperty(new Error("Must be implemented by subclasses."), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
    };
    return OasNodePathVisitor;
}(NodePathVisitor));
export { OasNodePathVisitor };
OasNodePathVisitor["__class"] = "io.apicurio.datamodels.openapi.visitors.OasNodePathVisitor";
OasNodePathVisitor["__interfaces"] = ["io.apicurio.datamodels.core.visitors.IVisitor", "io.apicurio.datamodels.openapi.visitors.IOasVisitor"];
//# sourceMappingURL=OasNodePathVisitor.js.map