const mongoose = require('mongoose');

const cafeOrderSchema = new mongoose.Schema({
  companyId: { type: mongoose.Schema.Types.ObjectId, ref: 'Company', required: true },
  branchId: { type: mongoose.Schema.Types.ObjectId, ref: 'Branch', required: true },
  userId:{ type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
  orderNo: { type: Number, required: true },
  tableNo: { type: Number, required: true },
  status: { type: String, default: 'pending', enum: ['pending', ,'paid', 'served','cancelled'] },
  transferStatus: { type: String, default: '',enum: ['','pending', 'accepted', 'rejected','returned'] },
  paymentType: { type: String, default: 'cash', enum: ['cash', ,'credit'] },
  transferFrom: { type: String, default: '' },
  customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: false,}
},
  { timestamps: true }); // Enable timestamps


module.exports = mongoose.model('CafeOrder', cafeOrderSchema);
 