"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomerNotifications = 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
    },
    id_user: {
        type: String
    },
    id_client: {
        type: String,
        optional: true
    },
    client_name: {
        type: String,
        optional: true
    },
    title: {
        type: String
    },
    message: {
        type: String
    },
    details: {
        type: String,
        optional: true
    },
    category: {
        type: String,
        optional: true
    },
    severity: {
        type: String,
        optional: true
    },
    status: {
        type: String,
        allowedValues: ['unread', 'read']
    },
    read_at: {
        type: Date,
        optional: true
    },
    read_by: {
        type: String,
        optional: true
    },
    source: {
        type: String,
        optional: true
    },
    source_id: {
        type: String,
        optional: true
    },
    action_label: {
        type: String,
        optional: true
    },
    action_route: {
        type: String,
        optional: true
    },
    dedupe_key: {
        type: String,
        optional: true
    },
    metadata: {
        type: Object,
        optional: true,
        blackbox: true
    },
    expires_at: {
        type: Date,
        optional: true
    },
    created_by: {
        type: String,
        optional: true
    },
    created_by_name: {
        type: String,
        optional: true
    }
};
exports.CustomerNotifications = 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: 'customer-notifications',
            schema: schema,
            useVersionCollection: false,
            useReportBuilder: false,
            reportBuilderLookupTables: [],
            timestamps: true,
            createLogs: false,
            checkSchema: true,
            collectionOptions: null
        });
        exports.CustomerNotifications = model.collection_main;
        exports.CustomerNotifications.createIndex({ id_user: 1, status: 1, createdAt: -1 });
        exports.CustomerNotifications.createIndex({ id_client: 1, createdAt: -1 });
        exports.CustomerNotifications.createIndex({ dedupe_key: 1, id_user: 1, createdAt: -1 });
        exports.CustomerNotifications.createIndex({ expires_at: 1 }, { expireAfterSeconds: 0 });
    }
    else {
        setImmediate(function () {
            initializeCollection();
        });
    }
}

//# sourceMappingURL=customer-notification.collection.js.map
