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 { ValidationRule } from '../../ValidationRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends ValidationRule
 * @author eric.wittmann@gmail.com
 */
var OasBodyParameterUniquenessValidationRule = /** @class */ (function (_super) {
    __extends(OasBodyParameterUniquenessValidationRule, _super);
    function OasBodyParameterUniquenessValidationRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitParameter(io.apicurio.datamodels.core.models.common.Parameter)
     * @param {Parameter} node
     */
    OasBodyParameterUniquenessValidationRule.prototype.visitParameter = function (node) {
        var param = node;
        var params = (node.parent()).getParameters();
        if (this.equals(param.in, "body")) {
            var count = this.countBodyParams(params);
            this.reportIf(count > 1, node, Constants.PROP_IN, this.map.apply(this));
        }
    };
    /**
     * Counts the # of body style params.
     * @param {OasParameter[]} params
     * @return {number}
     * @private
     */
    /*private*/ OasBodyParameterUniquenessValidationRule.prototype.countBodyParams = function (params) {
        var count = 0;
        for (var index165 = 0; index165 < params.length; index165++) {
            var parameter = params[index165];
            {
                if (this.equals(parameter.in, "body")) {
                    count++;
                }
            }
        }
        return count;
    };
    return OasBodyParameterUniquenessValidationRule;
}(ValidationRule));
export { OasBodyParameterUniquenessValidationRule };
OasBodyParameterUniquenessValidationRule["__class"] = "io.apicurio.datamodels.core.validation.rules.other.OasBodyParameterUniquenessValidationRule";
OasBodyParameterUniquenessValidationRule["__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=OasBodyParameterUniquenessValidationRule.js.map