const mongoose = require('mongoose');

const transactionSchema = new mongoose.Schema({
    type: String,
    date: {
        type: Date,
        default: Date.now
    },
    detail: String,
    bdetails:{
        bn: String,
        ban: Number,
        bbic: String,
        bbn: String
    },
    balance: Number,
    amount: Number,
    referencenumber: String,
    admindate: String,
    owner: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User'
    },
    status: String,
    action: String,
    
});

const cardtransactionSchema = new mongoose.Schema({
    type: String,
    amount: Number,
    referencenumber: String,
    admindate: String,
    status: String,
   
});

const loansSchema = new mongoose.Schema({
    type: String,
    amount: Number,
    amountdue: Number,
    duration: Number,
    status: String,
    date: {
        type: Date,
        default: Date.now
    },
    admindate: String,
    referencenumber: String,

})

module.exports = mongoose.model('Transaction', transactionSchema);
module.exports = mongoose.model('Cardtransaction', cardtransactionSchema);
module.exports = mongoose.model('Loans', loansSchema)