"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Files = 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
    },
    size: {
        type: Number
    },
    key: {
        type: String
    },
    type: {
        type: String
    },
    order: {
        type: Number
    },
    status: {
        type: String,
        optional: true
    },
    default: {
        type: Boolean,
        optional: true
    }
};
exports.Files = 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: 'files',
            schema: schema,
            useVersionCollection: false,
            useReportBuilder: true,
            reportBuilderLookupTables: [],
            timestamps: true,
            createLogs: false,
            checkSchema: true,
            collectionOptions: null,
            bypassSession: true
        });
        exports.Files = model.collection_main;
        exports.Files.createIndex({ type: 1, createdAt: 1 });
        exports.Files.createIndex({ key: 1 });
    }
    else {
        setImmediate(function () {
            initializeCollection();
        });
    }
}

//# sourceMappingURL=file.collection.js.map
