{
  "openapi": "3.1.0",
  "info": {
    "title": "Demonstracyjny kontrakt transportowy",
    "version": "1.0.0",
    "description": "Dane demonstracyjne. Kontrakt nie opisuje realnego providera ani klienta."
  },
  "paths": {
    "/shipments": {
      "post": {
        "operationId": "createShipmentExample",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/Shipment" }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Demonstracyjna odpowiedź",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ShipmentStatus" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Party": {
        "type": "object",
        "properties": {
          "name": { "type": "string" }
        }
      },
      "Location": {
        "type": "object",
        "properties": {
          "address": { "type": "string" }
        }
      },
      "Goods": {
        "type": "object",
        "properties": {
          "goods_description": { "type": "string" },
          "gross_mass": { "type": "number", "format": "double" },
          "package_count": { "type": "integer" },
          "dangerous_goods": {
            "type": "object",
            "properties": {
              "un_number": { "type": "string" }
            }
          }
        }
      },
      "Shipment": {
        "allOf": [
          {
            "type": "object",
            "required": ["shipment_id", "consignor", "consignee", "carrier", "goods"],
            "properties": {
              "shipment_id": { "type": "string", "format": "uuid" },
              "document_reference": { "type": "string" },
              "consignor": { "$ref": "#/components/schemas/Party" },
              "consignee": { "$ref": "#/components/schemas/Party" },
              "carrier": { "$ref": "#/components/schemas/Party" },
              "pickup_location": { "$ref": "#/components/schemas/Location" },
              "delivery_location": { "$ref": "#/components/schemas/Location" },
              "pickup_date": { "type": "string", "format": "date-time" },
              "delivery_date": { "type": "string", "format": "date-time" },
              "goods": { "$ref": "#/components/schemas/Goods" },
              "transport_mode": { "type": "string", "enum": ["road", "rail", "inland_waterway"] },
              "signature_reference": { "$ref": "https://schemas.example.invalid/signature.json#/Signature" }
            }
          }
        ]
      },
      "ShipmentStatus": {
        "type": "object",
        "properties": {
          "shipment_id": { "type": "string", "format": "uuid" },
          "status": { "type": "string", "enum": ["accepted", "rejected"] }
        }
      }
    }
  }
}
