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 { ValidationRule } from '../../ValidationRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends ValidationRule
 * @author eric.wittmann@gmail.com
 */
var RequiredPropertyValidationRule = /** @class */ (function (_super) {
    __extends(RequiredPropertyValidationRule, _super);
    function RequiredPropertyValidationRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * Called when a required property is missing.
     * @param {Node} node
     * @param {string} propertyName
     * @param {*} messageParams
     */
    RequiredPropertyValidationRule.prototype.requireProperty = function (node, propertyName, messageParams) {
        var propertyValue = NodeCompat.getProperty(node, propertyName);
        if (!this.isDefined(propertyValue)) {
            this.report(node, propertyName, messageParams);
        }
    };
    /**
     * Called when a conditionally required property is missing.
     * @param {Node} node
     * @param {string} propertyName
     * @param {string} dependentPropertyName
     * @param {*} dependentPropertyExpectedValue
     * @param {*} messageParams
     */
    RequiredPropertyValidationRule.prototype.requirePropertyWhen = function (node, propertyName, dependentPropertyName, dependentPropertyExpectedValue, messageParams) {
        var dependentPropertyActualValue = NodeCompat.getProperty(node, dependentPropertyName);
        if (NodeCompat.equals(dependentPropertyActualValue, dependentPropertyExpectedValue)) {
            this.requireProperty(node, propertyName, messageParams);
        }
    };
    return RequiredPropertyValidationRule;
}(ValidationRule));
export { RequiredPropertyValidationRule };
RequiredPropertyValidationRule["__class"] = "io.apicurio.datamodels.core.validation.rules.required.RequiredPropertyValidationRule";
RequiredPropertyValidationRule["__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=RequiredPropertyValidationRule.js.map