"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserGroupVersions = exports.UserGroups = void 0;
var mongo_manager_1 = require("../managers/mongo.manager");
var resolveio_server_app_1 = require("../resolveio-server-app");
var schema = {
    _id: {
        type: String,
        optional: true
    },
    __v: {
        type: Number,
        optional: true
    },
    updatedAt: {
        type: Date,
        optional: true
    },
    createdAt: {
        type: Date,
        optional: true
    },
    name: {
        type: String
    },
    landing_page: {
        type: String,
        optional: true
    },
    permissions: {
        type: Array
    },
    'permissions.$': {
        type: Object
    },
    'permissions.$.name': {
        type: String
    },
    'permissions.$.selected': {
        type: Boolean
    },
    'permissions.$.views': {
        type: Array
    },
    'permissions.$.views.$': {
        type: Object
    },
    'permissions.$.views.$.link': {
        type: String
    },
    'permissions.$.views.$.selected': {
        type: Boolean
    },
    notifications: {
        type: Array
    },
    'notifications.$': {
        type: Object,
        blackbox: true
    },
};
exports.UserGroups = null;
exports.UserGroupVersions = null;
initializeCollection();
function initializeCollection() {
    if (resolveio_server_app_1.ResolveIOServer && resolveio_server_app_1.ResolveIOServer.getMainDB() && mongo_manager_1.MongoManagerModel) {
        var model = mongo_manager_1.MongoManagerModel.create({
            collectionName: 'user-groups',
            schema: schema,
            useVersionCollection: true,
            useReportBuilder: true,
            reportBuilderLookupTables: [],
            timestamps: true,
            createLogs: false,
            checkSchema: true,
            collectionOptions: null
        });
        exports.UserGroups = model.collection_main;
        exports.UserGroups.createIndex({ name: 1 });
        exports.UserGroupVersions = model.collection_version;
    }
    else {
        setImmediate(function () {
            initializeCollection();
        });
    }
}

//# sourceMappingURL=user-group.collection.js.map
