{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cruise-itinerary-com/json-schema/cruise-itinerary-com-change-event-schema.json",
  "title": "ChangeEvent",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cruise-itinerary-com-openapi.json#/components/schemas/ChangeEvent",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "detected_on": {
      "type": "string",
      "description": "Load that revealed the change.",
      "format": "date"
    },
    "previous_on": {
      "type": "string",
      "description": "Load it was compared against.",
      "format": "date"
    },
    "kind": {
      "type": "string",
      "description": "`schedule_changed`: the sailing's route is the same but port days moved, were added or removed, or estimated days were confirmed by the line's own itinerary; re-fetch the sailing for its new days. It covers every rebuild of the day-by-day itineraries since the previous load, nightly ones included.",
      "enum": [
        "price_drop",
        "price_rise",
        "cabin_unavailable",
        "cabin_available",
        "sailing_added",
        "sailing_removed",
        "itinerary_changed",
        "schedule_changed"
      ]
    },
    "sailing_id": {
      "type": "integer"
    },
    "cruise_id": {
      "oneOf": [
        {
          "type": "string",
          "description": "Cruise slug."
        },
        {
          "type": "null"
        }
      ]
    },
    "previous_cruise_id": {
      "oneOf": [
        {
          "type": "string",
          "description": "For itinerary_changed: the cruise it replaced."
        },
        {
          "type": "null"
        }
      ]
    },
    "ship": {
      "oneOf": [
        {
          "$ref": "#/$defs/Ref"
        },
        {
          "type": "null"
        }
      ]
    },
    "line": {
      "oneOf": [
        {
          "$ref": "#/$defs/Ref"
        },
        {
          "type": "null"
        }
      ]
    },
    "departure_date": {
      "type": "string",
      "format": "date"
    },
    "cabin": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "inside",
            "outside",
            "balcony",
            "suite"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "old_value": {
      "oneOf": [
        {
          "type": "integer",
          "description": "Fare before, USD. For schedule_changed: port days whose date moved, or that were added or removed."
        },
        {
          "type": "null"
        }
      ]
    },
    "new_value": {
      "oneOf": [
        {
          "type": "integer",
          "description": "Fare after, USD. For schedule_changed: estimated days now exact."
        },
        {
          "type": "null"
        }
      ]
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD"
      ]
    }
  },
  "required": [
    "id",
    "detected_on",
    "previous_on",
    "kind",
    "sailing_id",
    "cruise_id",
    "previous_cruise_id",
    "ship",
    "line",
    "departure_date",
    "cabin",
    "old_value",
    "new_value",
    "currency"
  ],
  "additionalProperties": false,
  "$defs": {
    "Ref": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Slug."
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    }
  }
}