/**
 * Constructor.
 * @param {string} code
 * @param {string} name
 * @param {string} type
 * @param {string} entity
 * @param {Array} versions
 * @param {boolean} specMandated
 * @param {string} messageTemplate
 * @param {*} ruleClass
 * @class
 * @author eric.wittmann@gmail.com
 */
var ValidationRuleMetaData = /** @class */ (function () {
    function ValidationRuleMetaData(code, name, type, entity, versions, specMandated, messageTemplate, ruleClass) {
        var _this = this;
        if (((typeof code === 'string') || code === null) && ((typeof name === 'string') || name === null) && ((typeof type === 'string') || type === null) && ((typeof entity === 'string') || entity === null) && ((versions != null && versions instanceof Array && (versions.length == 0 || versions[0] == null || (typeof versions[0] === 'number'))) || versions === null) && ((typeof specMandated === 'boolean') || specMandated === null) && ((typeof messageTemplate === 'string') || messageTemplate === null) && ((ruleClass != null) || ruleClass === null)) {
            var __args = arguments;
            if (this.code === undefined)
                this.code = null;
            if (this.name === undefined)
                this.name = null;
            if (this.type === undefined)
                this.type = null;
            if (this.entity === undefined)
                this.entity = null;
            if (this.versions === undefined)
                this.versions = null;
            if (this.specMandated === undefined)
                this.specMandated = false;
            if (this.messageTemplate === undefined)
                this.messageTemplate = null;
            if (this.ruleClass === undefined)
                this.ruleClass = null;
            if (this.code === undefined)
                this.code = null;
            if (this.name === undefined)
                this.name = null;
            if (this.type === undefined)
                this.type = null;
            if (this.entity === undefined)
                this.entity = null;
            if (this.versions === undefined)
                this.versions = null;
            if (this.specMandated === undefined)
                this.specMandated = false;
            if (this.messageTemplate === undefined)
                this.messageTemplate = null;
            if (this.ruleClass === undefined)
                this.ruleClass = null;
            (function () {
                _this.code = code;
                _this.name = name;
                _this.type = type;
                _this.entity = entity;
                _this.versions = versions;
                _this.specMandated = specMandated;
                _this.messageTemplate = messageTemplate;
                _this.ruleClass = ruleClass;
            })();
        }
        else if (code === undefined && name === undefined && type === undefined && entity === undefined && versions === undefined && specMandated === undefined && messageTemplate === undefined && ruleClass === undefined) {
            var __args = arguments;
            if (this.code === undefined)
                this.code = null;
            if (this.name === undefined)
                this.name = null;
            if (this.type === undefined)
                this.type = null;
            if (this.entity === undefined)
                this.entity = null;
            if (this.versions === undefined)
                this.versions = null;
            if (this.specMandated === undefined)
                this.specMandated = false;
            if (this.messageTemplate === undefined)
                this.messageTemplate = null;
            if (this.ruleClass === undefined)
                this.ruleClass = null;
            if (this.code === undefined)
                this.code = null;
            if (this.name === undefined)
                this.name = null;
            if (this.type === undefined)
                this.type = null;
            if (this.entity === undefined)
                this.entity = null;
            if (this.versions === undefined)
                this.versions = null;
            if (this.specMandated === undefined)
                this.specMandated = false;
            if (this.messageTemplate === undefined)
                this.messageTemplate = null;
            if (this.ruleClass === undefined)
                this.ruleClass = null;
        }
        else
            throw new Error('invalid overload');
    }
    /**
     * Returns true if this rule applies to documents of the given type.
     * @param {DocumentType} type
     * @return {boolean}
     */
    ValidationRuleMetaData.prototype.appliesTo = function (type) {
        for (var index138 = 0; index138 < this.versions.length; index138++) {
            var version = this.versions[index138];
            {
                if (type === version) {
                    return true;
                }
            }
        }
        return false;
    };
    return ValidationRuleMetaData;
}());
export { ValidationRuleMetaData };
ValidationRuleMetaData["__class"] = "io.apicurio.datamodels.core.validation.ValidationRuleMetaData";
//# sourceMappingURL=ValidationRuleMetaData.js.map