"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoggedInUsers = 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
    },
    date: {
        type: Date
    },
    id_user: {
        type: String
    },
    user: {
        type: String
    },
    id_ws: {
        type: String
    },
    latency: {
        type: Number,
        optional: true
    }
};
exports.LoggedInUsers = 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: 'logged-in-users',
            schema: schema,
            useVersionCollection: false,
            useReportBuilder: false,
            reportBuilderLookupTables: [],
            timestamps: true,
            createLogs: false,
            checkSchema: true,
            collectionOptions: null,
            skipCache: true,
            bypassSession: true
        });
        exports.LoggedInUsers = model.collection_main;
        exports.LoggedInUsers.createIndex({ id_ws: 1 });
    }
    else {
        setImmediate(function () {
            initializeCollection();
        });
    }
}

//# sourceMappingURL=logged-in-users.collection.js.map
