const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const depositSchema = new Schema(
    {
        userId: { type: Schema.Types.ObjectId, ref: 'user', required: true },
        type: { type: String, enum: ['CARD', 'BANK'], required: true },
        network: { type: String }, // e.g., 'VIETTEL'
        code: { type: String },
        serial: { type: String },
        amount: { type: Number, required: true }, // Face value
        receivedAmount: { type: Number, required: true }, // Amount user receives after fee
        status: { type: String, enum: ['pending', 'success', 'failed', 'reject'], default: 'pending' },
        note: { type: String },
        requestId: { type: String }, // For tracking with 3rd party if needed
    },
    {
        timestamps: true,
    },
);

module.exports = mongoose.model('deposit', depositSchema);
