"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocalityRessourceName = exports.ImportDefaultValueType = exports.FilterMode = exports.AuditLogIcon = exports.AuditLogEntitySpecificType = exports.AuditLogCustom = exports.UIMenuGroupSeparator = exports.TimeInMilliseconds = exports.UserPreFilter = exports.DatePreFilter = exports.Various = exports.FilterDatePreset = exports.FieldType = exports.UserProfile = void 0;
var UserProfile = (function () {
    function UserProfile(userData) {
        this.id = userData.id;
        this.firstName = userData.firstName;
        this.lastName = userData.lastName;
        this.fullName = userData.fullName;
        this.username = userData.username;
        this.email = userData.email;
        if (userData.roleId != null) {
            this.roles = [userData.roleId];
        }
        else if (userData.roles != null && isArray(userData.roles)) {
            this.roles = userData.roles.map(function (x) { return x.roleId; });
        }
        else {
            this.roles = [];
        }
        this.language = userData.languageCode;
        this.userData = userData;
        if (userData.permissions != null) {
            this.permissions = userData.permissions.replace(/-/g, '').split(";");
        }
        try {
            this.settings = JSON.parse(userData.settings);
        }
        catch (e) {
            console.log(e);
        }
        finally {
            var sessionsSettings = sessionStorage.getItem("user-settings-".concat(this.id));
            if (sessionsSettings != null) {
                this.settings = JSON.parse(sessionsSettings);
            }
            this.settings = Object.assign({
                customSearchList: [],
                dataGridSettings: {}
            }, this.settings);
        }
    }
    Object.defineProperty(UserProfile.prototype, "sanitizedSettings", {
        get: function () {
            var obj = jQuery.extend(true, {}, this.settings);
            obj.customSearchList.forEach(function (x) {
                if (x.navModel)
                    delete x.navModel;
            });
            return obj;
        },
        enumerable: false,
        configurable: true
    });
    return UserProfile;
}());
exports.UserProfile = UserProfile;
var FieldType;
(function (FieldType) {
    FieldType["Base"] = "Base";
    FieldType["String"] = "String";
    FieldType["Number"] = "Number";
    FieldType["Date"] = "Date";
    FieldType["DateTime"] = "DateTime";
    FieldType["Boolean"] = "Boolean";
    FieldType["Enumeration"] = "Enumeration";
    FieldType["Enum"] = "Enum";
    FieldType["Html"] = "Html";
    FieldType["User"] = "User";
    FieldType["ManyToMany"] = "ManyToMany";
    FieldType["Currency"] = "Currency";
    FieldType["OneToMany"] = "OneToMany";
})(FieldType = exports.FieldType || (exports.FieldType = {}));
var FilterDatePreset;
(function (FilterDatePreset) {
    FilterDatePreset[FilterDatePreset["Past"] = 0] = "Past";
    FilterDatePreset[FilterDatePreset["Today"] = 1] = "Today";
    FilterDatePreset[FilterDatePreset["Futur"] = 2] = "Futur";
    FilterDatePreset[FilterDatePreset["IsLastMonth"] = 3] = "IsLastMonth";
    FilterDatePreset[FilterDatePreset["IsLastWeek"] = 4] = "IsLastWeek";
    FilterDatePreset[FilterDatePreset["IsThisWeek"] = 5] = "IsThisWeek";
    FilterDatePreset[FilterDatePreset["IsThisMonth"] = 6] = "IsThisMonth";
    FilterDatePreset[FilterDatePreset["IsNextWeek"] = 7] = "IsNextWeek";
    FilterDatePreset[FilterDatePreset["IsNextMonth"] = 8] = "IsNextMonth";
})(FilterDatePreset = exports.FilterDatePreset || (exports.FilterDatePreset = {}));
var Various = exports.Various = (function () {
    function Various() {
    }
    Various.NewId = -100;
    Various.DateFormat = "DD/MM/YYYY";
    Various.DateFormatWithHours = "DD/MM/YYYY HH:mm";
    return Various;
}());
var DatePreFilter;
(function (DatePreFilter) {
    DatePreFilter[DatePreFilter["None"] = 0] = "None";
    DatePreFilter[DatePreFilter["Today"] = 1] = "Today";
    DatePreFilter[DatePreFilter["Past"] = 2] = "Past";
    DatePreFilter[DatePreFilter["Futur"] = 3] = "Futur";
})(DatePreFilter = exports.DatePreFilter || (exports.DatePreFilter = {}));
var UserPreFilter;
(function (UserPreFilter) {
    UserPreFilter[UserPreFilter["None"] = 0] = "None";
    UserPreFilter[UserPreFilter["Me"] = 1] = "Me";
    UserPreFilter[UserPreFilter["NotMe"] = 2] = "NotMe";
})(UserPreFilter = exports.UserPreFilter || (exports.UserPreFilter = {}));
var TimeInMilliseconds = exports.TimeInMilliseconds = (function () {
    function TimeInMilliseconds() {
    }
    TimeInMilliseconds.DayInMilliseconds = 86400000;
    TimeInMilliseconds.WeekInMilliseconds = 604800000;
    return TimeInMilliseconds;
}());
var UIMenuGroupSeparator = exports.UIMenuGroupSeparator = (function () {
    function UIMenuGroupSeparator() {
    }
    UIMenuGroupSeparator.Blank = "blank";
    UIMenuGroupSeparator.Line = "line";
    return UIMenuGroupSeparator;
}());
var AuditLogCustom = (function () {
    function AuditLogCustom() {
    }
    return AuditLogCustom;
}());
exports.AuditLogCustom = AuditLogCustom;
var AuditLogEntitySpecificType = (function () {
    function AuditLogEntitySpecificType() {
    }
    return AuditLogEntitySpecificType;
}());
exports.AuditLogEntitySpecificType = AuditLogEntitySpecificType;
var AuditLogIcon = (function () {
    function AuditLogIcon() {
    }
    return AuditLogIcon;
}());
exports.AuditLogIcon = AuditLogIcon;
var FilterMode;
(function (FilterMode) {
    FilterMode[FilterMode["Or"] = 0] = "Or";
    FilterMode[FilterMode["And"] = 1] = "And";
})(FilterMode = exports.FilterMode || (exports.FilterMode = {}));
var ImportDefaultValueType;
(function (ImportDefaultValueType) {
    ImportDefaultValueType[ImportDefaultValueType["Input"] = 0] = "Input";
    ImportDefaultValueType[ImportDefaultValueType["Date"] = 1] = "Date";
    ImportDefaultValueType[ImportDefaultValueType["Select"] = 2] = "Select";
})(ImportDefaultValueType = exports.ImportDefaultValueType || (exports.ImportDefaultValueType = {}));
exports.LocalityRessourceName = "Locality";

//# sourceMappingURL=common-model.js.map
