"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.enumerationTypeDetailViewTemplate = exports.enumerationTypeListViewTemplate = exports.EnumerationTypeColorRessourceName = exports.EnumerationTypeRessourceName = exports.validateEnumerationType = void 0;
var translated_property_rules_1 = require("./translated-property-rules");
function validateEnumerationType(entity, isUniqueCodeRequired) {
    if (isUniqueCodeRequired === void 0) { isUniqueCodeRequired = false; }
    var rules = translated_property_rules_1.TranslatedPropertyRules.anyRequired('denomination')
        .withMessage('common:validation.enumType.denomination')
        .ensure('default').satisfies(function (value, enumType) {
        return value == false || enumType.active;
    }).withMessage('common:validation.enumType.default');
    if (isUniqueCodeRequired) {
        rules.ensure('uniqueCode').required();
    }
    rules.on(entity);
}
exports.validateEnumerationType = validateEnumerationType;
var enumerationTypeViewTemplate = function (type) {
    return 'digiwall-lib/vm/enumeration-types/enumeration-type-' + type + '-view-model-base.html';
};
exports.EnumerationTypeRessourceName = "EnumerationType";
exports.EnumerationTypeColorRessourceName = "EnumerationTypeColor";
var enumerationTypeListViewTemplate = function () {
    return enumerationTypeViewTemplate('list');
};
exports.enumerationTypeListViewTemplate = enumerationTypeListViewTemplate;
var enumerationTypeDetailViewTemplate = function () {
    return enumerationTypeViewTemplate('detail');
};
exports.enumerationTypeDetailViewTemplate = enumerationTypeDetailViewTemplate;

//# sourceMappingURL=enumeration-types-helper.js.map
