openapi: "3.0.3"
info:
  title: "Shipment tracking API"
  version: "1.0.0"
  description: "The scan rows are the part a mock server cannot synthesise, because they are history rather than response. The status enum here has three members and differs from the four-member enum used in the shipping fixture on the comparison page. The tracking code is unique, so the generator has to avoid collisions across the whole fixture. The fixture is deliberately small so that the difference between a stub and a seeded table is visible in one file."
paths: {}
x-domain-id: "alt_logistics"
x-dialect: "postgres"
components:
  schemas:
    shipments:
      type: "object"
      x-primary-key: "id"
      required: ["id", "tracking", "carrier", "status", "created_at"]
      properties:
        id:
          type: "string"
          format: "uuid"
        tracking:
          type: "string"
          x-unique: true
        carrier:
          type: "string"
        status:
          type: "string"
          enum: ["label_created", "in_transit", "delivered"]
        created_at:
          type: "string"
          format: "date-time"
    scans:
      type: "object"
      x-primary-key: "id"
      required: ["id", "shipment_id", "scanned_at", "code"]
      properties:
        id:
          type: "string"
          format: "uuid"
        shipment_id:
          $ref: "#/components/schemas/shipments"
        scanned_at:
          type: "string"
          format: "date-time"
        code:
          type: "string"
