const mongoose = require('mongoose');

const deliverySchema = new mongoose.Schema(
  {
    deliveryCode: {
      type: String,
      required: true,
      trim: true,
      unique: true,
    },
    deliveryDate: {
      type: Date,
      required: true,
    },
    quantityDelivered: {
      type: Number,
      required: true,
    },
    deliveryStatus: {
      type: String,
      required: true,
      trim: true,
    },
    shipment: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Shipment',
      required: false,
    },
  },
  { timestamps: true }
);

module.exports = mongoose.model('Delivery', deliverySchema);
