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 { Constants } from '../../../../Constants';
import { OasInvalidPropertyValueRule } from './OasInvalidPropertyValueRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends OasInvalidPropertyValueRule
 * @author eric.wittmann@gmail.com
 */
var OasUnexpectedXmlWrappingRule = /** @class */ (function (_super) {
    __extends(OasUnexpectedXmlWrappingRule, _super);
    function OasUnexpectedXmlWrappingRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * Returns true if it's OK to use "wrapped" in the XML node.  It's only OK to do this if
     * the type being defined is an 'array' type.
     * @param {OasXML} xml
     * @return {boolean}
     */
    OasUnexpectedXmlWrappingRule.prototype.isWrappedOK = function (xml) {
        var schema = xml.parent();
        return this.equals(schema.type, "array");
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitXML(io.apicurio.datamodels.openapi.models.OasXML)
     * @param {OasXML} node
     */
    OasUnexpectedXmlWrappingRule.prototype.visitXML = function (node) {
        if (this.hasValue(node.wrapped)) {
            this.reportIfInvalid(this.isWrappedOK(node), node, Constants.PROP_WRAPPED, this.map.apply(this));
        }
    };
    return OasUnexpectedXmlWrappingRule;
}(OasInvalidPropertyValueRule));
export { OasUnexpectedXmlWrappingRule };
OasUnexpectedXmlWrappingRule["__class"] = "io.apicurio.datamodels.core.validation.rules.invalid.value.OasUnexpectedXmlWrappingRule";
OasUnexpectedXmlWrappingRule["__interfaces"] = ["io.apicurio.datamodels.core.visitors.IVisitor", "io.apicurio.datamodels.asyncapi.v2.visitors.IAai20Visitor", "io.apicurio.datamodels.openapi.v3.visitors.IOas30Visitor", "io.apicurio.datamodels.asyncapi.visitors.IAaiVisitor", "io.apicurio.datamodels.openapi.v2.visitors.IOas20Visitor", "io.apicurio.datamodels.openapi.visitors.IOasVisitor"];
//# sourceMappingURL=OasUnexpectedXmlWrappingRule.js.map