import uuid from django.db import models class Shipment(models.Model): class Status(models.TextChoices): BOOKED = "booked", "Booked" LOADING = "loading", "Loading" DEPARTED = "departed", "Departed" IN_TRANSIT = "in_transit", "In Transit" ARRIVED_UK = "arrived_uk", "Arrived UK" CUSTOMS_CLEARANCE = "customs_clearance", "Customs Clearance" DELIVERED = "delivered", "Delivered" id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) batch = models.ForeignKey("batches.ProcessingBatch", on_delete=models.CASCADE, related_name="shipments") status = models.CharField(max_length=20, choices=Status.choices, default=Status.BOOKED) origin_port = models.CharField(max_length=255, default="Apapa Port, Lagos") destination_port = models.CharField(max_length=255, default="Port of Felixstowe") vessel_name = models.CharField(max_length=255, blank=True) container_ref = models.CharField(max_length=255, blank=True) etd_nigeria = models.DateField(null=True, blank=True) eta_uk = models.DateField(null=True, blank=True) bl_number = models.CharField(max_length=255, blank=True) freight_forwarder = models.CharField(max_length=255, blank=True) created_at = models.DateTimeField(auto_now_add=True) class Meta: db_table = "shipments" ordering = ["-created_at"] def __str__(self): return f"Shipment {self.batch.batch_reference} - {self.status}"