const mongoose = require('mongoose');

const transactionSchema = new mongoose.Schema({
  companyId: { type: mongoose.Schema.Types.ObjectId, ref: 'Company', required: true },
  branchId: { type: mongoose.Schema.Types.ObjectId, ref: 'Branch', required: true },
  customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer', required: false },
  transactionType: { type: String, enum: ['ordering','selling', 'purchasing','using','producing'], required: true },
 // orderStatus:{type:String,enum:['','par-paid','paid'],required:false,default:''},
  orderId:{  type: mongoose.Schema.Types.ObjectId, ref: 'Order', required: false },
  paymentId:{  type: mongoose.Schema.Types.ObjectId, ref: 'PaymentDetail', required: false },
 // orderPaymentDate:{type:Date,required:false},
  totalItems: { type: Number,  required: false },
   subtotal: { type: Number,  required: false },

}, { timestamps: true });

module.exports = mongoose.model('Transaction', transactionSchema);


//status  par-paid  kehone :   tedmari nachew, betederegubet ken(betazezubet)
// sattus paid kehone degmo yemidemerew (total-prepaid) amount new