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 { ValidationRule } from '../../ValidationRule';
/**
 * Constructor.
 * @param {ValidationRuleMetaData} ruleInfo
 * @class
 * @extends ValidationRule
 * @author eric.wittmann@gmail.com
 */
var TagUniquenessValidationRule = /** @class */ (function (_super) {
    __extends(TagUniquenessValidationRule, _super);
    function TagUniquenessValidationRule(ruleInfo) {
        return _super.call(this, ruleInfo) || this;
    }
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitTag(io.apicurio.datamodels.core.models.common.Tag)
     * @param {Tag} node
     */
    TagUniquenessValidationRule.prototype.visitTag = function (node) {
        var tags = node.ownerDocument().tags;
        var tcount = 0;
        for (var index152 = 0; index152 < tags.length; index152++) {
            var tag = tags[index152];
            {
                if (this.equals(tag.name, node.name)) {
                    tcount++;
                }
            }
        }
        this.reportIf(tcount > 1, node, node.name, this.map("tagName", node.name));
    };
    return TagUniquenessValidationRule;
}(ValidationRule));
export { TagUniquenessValidationRule };
TagUniquenessValidationRule["__class"] = "io.apicurio.datamodels.core.validation.rules.other.TagUniquenessValidationRule";
TagUniquenessValidationRule["__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=TagUniquenessValidationRule.js.map