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 { ReferenceUtil } from '../../../../util/ReferenceUtil';
import { ValidationRule } from '../../../ValidationRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends ValidationRule
 * @author eric.wittmann@gmail.com
 */
var OasInvalidPropertyValueRule = /** @class */ (function (_super) {
    __extends(OasInvalidPropertyValueRule, _super);
    function OasInvalidPropertyValueRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * Returns true if the given media type name is multipart/* or application/x-www-form-urlencoded
     * @param {string} typeName
     * @return {boolean}
     */
    OasInvalidPropertyValueRule.prototype.isValidMultipartType = function (typeName) {
        return this.equals(typeName, "application/x-www-form-urlencoded") || typeName.indexOf("multipart") === 0;
    };
    /**
     * Merges all parameters applicable for an operation - those defined within the operation and those defined at the pathItem level.
     * Resolves parameters that are not defined inline but are referenced from the components/parameters section.
     * @param {OasOperation} node
     * @return {OasParameter[]}
     */
    OasInvalidPropertyValueRule.prototype.mergeParameters = function (node) {
        var indexedParams = ({});
        var parentNode = node.parent();
        if (this.hasValue(parentNode.parameters)) {
            for (var index145 = 0; index145 < parentNode.parameters.length; index145++) {
                var param = parentNode.parameters[index145];
                {
                    var resolutionResult = ReferenceUtil.resolveNodeRef$io_apicurio_datamodels_core_models_Node(param);
                    if (this.hasValue(resolutionResult)) {
                        var key = resolutionResult.in + "-" + resolutionResult.name;
                        /* put */ (indexedParams[key] = resolutionResult);
                    }
                }
            }
        }
        if (this.hasValue(node.parameters)) {
            for (var index146 = 0; index146 < node.parameters.length; index146++) {
                var param = node.parameters[index146];
                {
                    var resolutionResult = ReferenceUtil.resolveNodeRef$io_apicurio_datamodels_core_models_Node(param);
                    if (this.hasValue(resolutionResult)) {
                        var key = resolutionResult.in + "-" + resolutionResult.name;
                        /* put */ (indexedParams[key] = resolutionResult);
                    }
                }
            }
        }
        var mergedParameters = ([]);
        /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(mergedParameters, /* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(indexedParams));
        return mergedParameters;
    };
    return OasInvalidPropertyValueRule;
}(ValidationRule));
export { OasInvalidPropertyValueRule };
OasInvalidPropertyValueRule["__class"] = "io.apicurio.datamodels.core.validation.rules.invalid.value.OasInvalidPropertyValueRule";
OasInvalidPropertyValueRule["__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=OasInvalidPropertyValueRule.js.map