const mongoose = require('mongoose');

const SaleSchema = new mongoose.Schema({
  invoiceNumber: { type: String, required: true, unique: true },
  salesDate: { type: Date, required: true },
  paymentMethod: { type: String, required: true },
  totalAmountPaid: { type: Number, required: true },
  customerNumber: { type: String, required: true, ref: 'Customer' },
  productCode: { type: String, required: true, ref: 'Product' },
  quantitySold: { type: Number, required: true },
});

module.exports = mongoose.model('Sale', SaleSchema);
