"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReportBuilderLibraries = 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
    },
    id_user_create: {
        type: String
    },
    user_create: {
        type: String
    },
    date: {
        type: Date
    },
    reports: {
        type: Array
    },
    'reports.$': {
        type: Object
    },
    'reports.$.id_report': {
        type: String
    },
    'reports.$.report': {
        type: String
    },
    user_groups: {
        type: Array
    },
    'user_groups.$': {
        type: Object
    },
    'user_groups.$.id_user_group': {
        type: String
    },
    'user_groups.$.user_group': {
        type: String
    }
};
exports.ReportBuilderLibraries = 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: 'report-builder-libraries',
            schema: schema,
            useVersionCollection: false,
            useReportBuilder: false,
            reportBuilderLookupTables: [],
            timestamps: true,
            createLogs: true,
            checkSchema: true,
            collectionOptions: null
        });
        exports.ReportBuilderLibraries = model.collection_main;
        exports.ReportBuilderLibraries.createIndex({ name: 1 });
        exports.ReportBuilderLibraries.createIndex({ id_user_create: 1 });
        exports.ReportBuilderLibraries.createIndex({ 'user_groups.id_user_group': 1 });
    }
    else {
        setImmediate(function () {
            initializeCollection();
        });
    }
}

//# sourceMappingURL=report-builder-library.collection.js.map
