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 { OasInvalidPropertyNameRule } from './OasInvalidPropertyNameRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends OasInvalidPropertyNameRule
 * @author eric.wittmann@gmail.com
 */
var OasUnmatchedEncodingPropertyRule = /** @class */ (function (_super) {
    __extends(OasUnmatchedEncodingPropertyRule, _super);
    function OasUnmatchedEncodingPropertyRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * Returns true if the given schema has a property defined with the given name.
     * @param {Oas30Schema} schema
     * @param {string} propertyName
     * @return {boolean} {boolean}
     * @param {OasSchema} schema
     * @param {string} propertyName
     * @private
     */
    /*private*/ OasUnmatchedEncodingPropertyRule.prototype.isValidSchemaProperty = function (schema, propertyName) {
        if (this.isNullOrUndefined(schema)) {
            return false;
        }
        return !this.isNullOrUndefined(schema.getProperty(propertyName));
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitEncoding(io.apicurio.datamodels.openapi.v3.models.Oas30Encoding)
     * @param {Oas30Encoding} node
     */
    OasUnmatchedEncodingPropertyRule.prototype.visitEncoding = function (node) {
        var name = node.getName();
        var schema = (node.parent()).schema;
        this.reportIfInvalid(this.isValidSchemaProperty(schema, name), node, name, this.map("name", name));
    };
    return OasUnmatchedEncodingPropertyRule;
}(OasInvalidPropertyNameRule));
export { OasUnmatchedEncodingPropertyRule };
OasUnmatchedEncodingPropertyRule["__class"] = "io.apicurio.datamodels.core.validation.rules.invalid.name.OasUnmatchedEncodingPropertyRule";
OasUnmatchedEncodingPropertyRule["__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=OasUnmatchedEncodingPropertyRule.js.map