{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cruise-itinerary-com/json-schema/cruise-itinerary-com-port-day-detail-schema.json",
  "title": "PortDayDetail",
  "description": "The ships behind the counts. Named calls, not ships, because ships is already the count.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cruise-itinerary-com-openapi.json#/components/schemas/PortDayDetail",
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date"
    },
    "ships": {
      "type": "integer",
      "description": "Distinct ships in port."
    },
    "berths": {
      "type": "integer",
      "description": "Sum of known lower-berth capacity."
    },
    "ships_no_capacity": {
      "type": "integer",
      "description": "Ships counted whose capacity is unknown."
    },
    "embark_ships": {
      "type": "integer",
      "description": "Includes turnarounds."
    },
    "disembark_ships": {
      "type": "integer",
      "description": "Includes turnarounds."
    },
    "turnaround_ships": {
      "type": "integer",
      "description": "Ships that disembark one sailing and embark the next the same day."
    },
    "estimated_ships": {
      "type": "integer",
      "description": "Ships whose day here is estimated rather than exact."
    },
    "busy_pct": {
      "oneOf": [
        {
          "type": "integer",
          "description": "Percentile among this port's busy days within a year either side. 100 is the busiest."
        },
        {
          "type": "null"
        }
      ]
    },
    "calls": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ship": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "passengers": {
                "oneOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "name",
              "passengers"
            ],
            "additionalProperties": false
          },
          "line": {
            "oneOf": [
              {
                "$ref": "#/$defs/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "embark",
              "call",
              "scenic",
              "disembark",
              "turnaround"
            ]
          },
          "day_confidence": {
            "type": "string",
            "enum": [
              "exact",
              "estimated"
            ]
          },
          "sailing_id": {
            "type": "integer"
          }
        },
        "required": [
          "ship",
          "line",
          "kind",
          "day_confidence",
          "sailing_id"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "date",
    "ships",
    "berths",
    "ships_no_capacity",
    "embark_ships",
    "disembark_ships",
    "turnaround_ships",
    "estimated_ships",
    "busy_pct",
    "calls"
  ],
  "additionalProperties": false,
  "$defs": {
    "Ref": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Slug."
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    }
  }
}