"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TranslatedPropertyRules = void 0;
var config_1 = require("../config");
var aurelia_framework_1 = require("aurelia-framework");
var aurelia_validation_1 = require("aurelia-validation");
var TranslatedPropertyRules = (function () {
    function TranslatedPropertyRules() {
    }
    TranslatedPropertyRules.anyRequired = function (key) {
        var _this = this;
        return aurelia_validation_1.ValidationRules.ensure(key)
            .satisfies(function (value) {
            return _this.languages.reduce(function (valid, language) {
                return valid || (value['lang' + (language.columnIndex)] && value['lang' + (language.columnIndex)].length > 0);
            }, false);
        });
    };
    TranslatedPropertyRules.allRequired = function (key) {
        var _this = this;
        return aurelia_validation_1.ValidationRules.ensure(key)
            .satisfies(function (value) {
            return _this.languages.reduce(function (valid, language) {
                return valid && (value['lang' + (language.columnIndex)] && value['lang' + (language.columnIndex)].length > 0);
            }, true);
        });
    };
    Object.defineProperty(TranslatedPropertyRules, "languages", {
        get: function () {
            return aurelia_framework_1.Container.instance.get(config_1.Config).globalConfig.configuredLanguages || [];
        },
        enumerable: false,
        configurable: true
    });
    return TranslatedPropertyRules;
}());
exports.TranslatedPropertyRules = TranslatedPropertyRules;

//# sourceMappingURL=translated-property-rules.js.map
