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 OasBodyAndFormDataMutualExclusivityRule = /** @class */ (function (_super) {
    __extends(OasBodyAndFormDataMutualExclusivityRule, _super);
    function OasBodyAndFormDataMutualExclusivityRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /*private*/ OasBodyAndFormDataMutualExclusivityRule.prototype.visitParameterParent = function (paramParent) {
        var parameters = paramParent.getParameters();
        if (this.hasValue(parameters)) {
            var hasBodyParam = false;
            var hasFormDataParam = false;
            for (var index158 = 0; index158 < parameters.length; index158++) {
                var param = parameters[index158];
                {
                    if (this.equals(param.in, "body")) {
                        hasBodyParam = true;
                    }
                    if (this.equals(param.in, "formData")) {
                        hasFormDataParam = true;
                    }
                }
            }
            this.reportIf(hasBodyParam && hasFormDataParam, paramParent, Constants.PROP_IN, this.map.apply(this));
        }
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitOperation(io.apicurio.datamodels.core.models.common.Operation)
     * @param {Operation} node
     */
    OasBodyAndFormDataMutualExclusivityRule.prototype.visitOperation = function (node) {
        this.visitParameterParent(node);
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitPathItem(io.apicurio.datamodels.openapi.models.OasPathItem)
     * @param {OasPathItem} node
     */
    OasBodyAndFormDataMutualExclusivityRule.prototype.visitPathItem = function (node) {
        this.visitParameterParent(node);
    };
    return OasBodyAndFormDataMutualExclusivityRule;
}(ValidationRule));
export { OasBodyAndFormDataMutualExclusivityRule };
OasBodyAndFormDataMutualExclusivityRule["__class"] = "io.apicurio.datamodels.core.validation.rules.mutex.OasBodyAndFormDataMutualExclusivityRule";
OasBodyAndFormDataMutualExclusivityRule["__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=OasBodyAndFormDataMutualExclusivityRule.js.map