const mongoose = require('mongoose');

const PaymentDetailSchema = new mongoose.Schema(
  {
    cash: { type: Number, required: true, default: 0 }, // Cash payment amount
    bank: { type: Number, required: true, default: 0 }, // Bank payment amount
    credit: { type: Number, required: true, default: 0 }, // Credit payment amount
    other: { type: Number, required: true, default: 0 }, // Other payment amount
    description: { type: String, required: false, trim: true }, // Additional details or remarks
  },
  { timestamps: true } // Automatically adds createdAt and updatedAt fields
);

module.exports = mongoose.model('PaymentDetail', PaymentDetailSchema);
