import { Config } from "../config";
import { Container } from 'aurelia-framework';
import { ValidationRules } from "aurelia-validation";
var TranslatedPropertyRules = (function () {
    function TranslatedPropertyRules() {
    }
    TranslatedPropertyRules.anyRequired = function (key) {
        var _this = this;
        return 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 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 Container.instance.get(Config).globalConfig.configuredLanguages || [];
        },
        enumerable: false,
        configurable: true
    });
    return TranslatedPropertyRules;
}());
export { TranslatedPropertyRules };

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