const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const logSchema = new Schema(
    {
        userId: { type: Schema.Types.ObjectId, ref: 'user', required: true },
        action: { type: String, required: true }, // e.g., 'LOGIN', 'REGISTER', 'DEPOSIT', 'BUY_ACCOUNT'
        content: { type: String, required: true },
        ipAddress: { type: String, default: 'Unknown' },
        userAgent: { type: String, default: 'Unknown' },
    },
    {
        timestamps: true,
    },
);

module.exports = mongoose.model('Log', logSchema);
