const mongoose = require('mongoose');

const orderProductSchema = new mongoose.Schema({
    order: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Order',
        required: true,
      },
      product: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Product',
        required: true,
      },
      quantity: {
        type: Number,
        required: false,
        default: 1,
      }
}, {
    timestamps: true,
    collection: 'orderProducts'
})

module.exports = mongoose.model("OrderProduct", orderProductSchema);