const mongoose = require('mongoose');
const { tenantFields, applyPlatformPlugins } = require('../platformFields');

const schema = new mongoose.Schema({
  ...tenantFields,
  sale: { type: mongoose.Schema.ObjectId, ref: 'PosSale', required: true, autopopulate: true },
  receiptNumber: { type: String, required: true },
  printable: mongoose.Schema.Types.Mixed,
  barcodeValue: String,
  printedAt: Date,
});

module.exports = mongoose.model('PosReceipt', applyPlatformPlugins(schema));
