var mongoose = require("mongoose");

var shipmentSchema = new mongoose.Schema(
  {
    supplier: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Supplier",
      required: [true, "Supplier is required"],
    },
    shipmentNumber: {
      type: String,
      required: [true, "Shipment number is required"],
      unique: true,
      trim: true,
    },
    shipmentDate: {
      type: Date,
      required: [true, "Shipment date is required"],
    },
    shipmentStatus: {
      type: String,
      required: [true, "Shipment status is required"],
      enum: ["Pending", "In Transit", "Delivered", "Cancelled"],
    },
    destination: {
      type: String,
      required: [true, "Destination is required"],
      trim: true,
    },
  },
  { timestamps: true }
);

module.exports = mongoose.model("Shipment", shipmentSchema);
