"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserLog = exports.UserLogSchema = exports.ELogActionType = exports.ELogType = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const _models_1 = require("./_models");
var ELogType;
(function (ELogType) {
    ELogType["TRANSACTIONS_UPLOAD"] = "TRANSACTIONS_UPLOAD";
    ELogType["COLLATERAL_UPLOAD"] = "COLLATERAL_UPLOAD";
    ELogType["LOAN_TRANSACTION"] = "LOAN_TRANSACTION";
    ELogType["RECEIVABLE_AVAILABILITY"] = "RECEIVABLE_AVAILABILITY";
    ELogType["INVENTORY_AVAILABILITY"] = "INVENTORY_AVAILABILITY";
    ELogType["EQUIPMENT"] = "EQUIPMENT";
    ELogType["RESERVES"] = "RESERVES";
    ELogType["COLLATERAL_ADJUSTMENTS"] = "COLLATERAL_ADJUSTMENTS";
    ELogType["LOGIN"] = "LOGIN";
    ELogType["SIGN_BBC"] = "SIGN_BBC";
    ELogType["REVOKE_BBC"] = "REVOKE_BBC";
    ELogType["PROSPECT"] = "PROSPECT";
})(ELogType || (exports.ELogType = ELogType = {}));
var ELogActionType;
(function (ELogActionType) {
    ELogActionType["UPLOAD"] = "UPLOAD";
    ELogActionType["CREATE"] = "CREATE";
    ELogActionType["EDIT"] = "EDIT";
    ELogActionType["DELETE"] = "DELETE";
})(ELogActionType || (exports.ELogActionType = ELogActionType = {}));
exports.UserLogSchema = new mongoose_1.default.Schema({
    logType: {
        type: String,
        enum: Object.values(ELogType),
        required: true,
    },
    userId: {
        type: String,
        required: true,
    },
    timestamp: {
        type: Date,
        required: true,
    },
    action: {
        type: String,
        enum: Object.values(ELogActionType),
        required: true,
    },
    recordId: {
        type: mongoose_1.default.Schema.Types.ObjectId,
    },
    recordCollection: {
        type: String,
    },
    details: {
        type: mongoose_1.default.Schema.Types.Mixed,
        required: true,
    },
}, {
    timestamps: { createdAt: true, updatedAt: false },
});
exports.UserLog = mongoose_1.default.model(_models_1.MODEL_NAMES.userLogs, exports.UserLogSchema);
