{
  "$id": "https://schemas.ruter.no/adt/ota/api/v2.1/operational-information/expected-call.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ExpectedCall",
  "type": "object",
  "required": [
    "updatedAtDateTime",
    "vehicleJourneyRef",
    "callSequenceNumber",
    "pointRef",
    "atStop",
    "serviceDeviation"
  ],
  "description": "The expected call object.",
  "additionalProperties": true,
  "properties": {
    "updatedAtDateTime": {
      "$id": "#/properties/updatedAtDateTime",
      "type": "string",
      "description": "Time when last updated. ISO 8601, UTC."
    },
    "vehicleJourneyRef": {
      "$id": "#/properties/vehicleJourneyRef",
      "type": "string",
      "description": "A Vehicle Journey identifier."
    },
    "callSequenceNumber": {
      "$id": "#/properties/callSequenceNumber",
      "type": "number",
      "description": "Order number of stop in journey pattern."
    },
    "pointRef": {
      "$id": "#/properties/pointRef",
      "type": "string",
      "description": "A stop identifier."
    },
    "tariffZone": {
      "$id": "#/properties/tariffZone",
      "$ref": "#/definitions/tariffZoneInfo",
      "description": "Optional. The tariff zone of the stop."
    },
    "atStop": {
      "$id": "#/properties/atStop",
      "type": "boolean",
      "description": "True if vehicle is standing at (has arrived to) the stop. False when between stops.",
      "examples": [
        "true",
        "false"
      ]
    },
    "estimatedTimeOfArrival": {
      "$id": "#/properties/estimatedTimeOfArrival",
      "type": "string",
      "description": "Optional. Only provided if the vehicle has not arrived at this stop. ISO 8601, UTC."
    },
    "observedTimeOfArrival": {
      "$id": "#/properties/observedTimeOfArrival",
      "type": "string",
      "description": "Optional. Only provided if the vehicle has arrived at this stop. ISO 8601, UTC."
    },
    "estimatedTimeOfDeparture": {
      "$id": "#/properties/estimatedTimeOfDeparture",
      "type": "string",
      "description": "Optional. Usually not provided for the last call of the journey. ISO 8601, UTC."
    },
    "serviceDeviation": {
      "$id": "#/properties/serviceDeviation",
      "type": "number",
      "description": "Value related to timetable or regularity depending on operation mode. A negative value indicates the number of seconds the vehicle journey is behind optimal time and a positive value indicates the number of seconds it is ahead of optimal time."
    },
    "holdReason": {
      "$id": "#/properties/holdReason",
      "type": "string",
      "description": "Optional. Only provided if vehicle should hold. Describes the reason why the driver should hold at this stop. Possible values in examples.",
      "examples": [
        "CONNECTION_PROTECTION",
        "TIMING_POINT",
        "DRIVER_CHANGE"
      ]
    },
    "holdUntil": {
      "$id": "#/properties/holdUntil",
      "type": "string",
      "description": "Optional. Only provided if vehicle should hold. Time of earliest permitted departure. ISO 8601, UTC."
    },
    "restriction": {
      "$id": "#/properties/restriction",
      "type": "string",
      "description": "Optional. Only provided if boarding or alighting restriction applies based on a combination of planned restrictions and partial journey cancellations. Possible values in examples.",
      "examples": [
        "NO_BOARDING",
        "NO_ALIGHTING",
        "NO_STOP"
      ]
    },
    "previousCall": {
      "$id": "#/properties/previousCall",
      "$ref": "#/definitions/call",
      "description": "Optional. Describes the call to the stop immediately preceding the expected call. Only provided if there is at least one call in the journey before the expected call."
    },
    "laterCalls": {
      "$id": "#/properties/laterCalls",
      "type": "array",
      "description": "Optional. Only provided if there are any calls in the journey after the expected call. Describes a configured number of calls that follow in sequence after the expected call. Note that the first item in the list represents the \"next stop\" only when the vehicle is standing at a stop. If the vehicle is between stops then the first item represents the first stop after the next stop. The configured max number of later Calls to be expected should be provided in configValue01 for this topic under topic tobs/mi/provider_clients//provided_topics.",
      "items": {
        "$ref": "#/definitions/call"
      }
    }
  },
  "definitions": {
    "call": {
      "type": "object",
      "title": "Call",
      "required": [
        "callSequenceNumber",
        "pointRef"
      ],
      "properties": {
        "callSequenceNumber": {
          "type": "number",
          "description": "Order number of stop in journey pattern. (One-based list)."
        },
        "pointRef": {
          "type": "string",
          "description": "A stop identifier."
        },
        "estimatedTimeOfArrival": {
          "type": "string",
          "description": "Optional. Only provided if the vehicle has not arrived at this stop. ISO 8601, UTC."
        },
        "observedTimeOfArrival": {
          "type": "string",
          "description": "Optional. Only provided if the vehicle has arrived at this stop. ISO 8601, UTC."
        },
        "estimatedTimeOfDeparture": {
          "type": "string",
          "description": "Optional. Usually not provided for the last call of the journey. ISO 8601, UTC."
        },
        "observedTimeOfDeparture": {
          "type": "string",
          "description": "Optional. Only provided if the vehicle has departed from this stop. ISO 8601, UTC."
        },
        "restriction": {
          "type": "string",
          "description": "Optional. Only provided if boarding or alighting restriction applies based on a combination of planned restrictions and partial journey cancellations. Possible values in examples.",
          "examples": [
            "NO_BOARDING",
            "NO_ALIGHTING",
            "NO_STOP"
          ]
        }
      }
    },
    "tariffZoneInfo": {
      "type": "object",
      "title": "Tariff Zone Info",
      "required": [
        "ref",
        "number"
      ],
      "properties": {
        "ref": {
          "type": "string",
          "description": "A unique identifier."
        },
        "number": {
          "type": "string",
          "description": "The number of the tariff zone unique within the transport authority."
        },
        "code": {
          "type": "string",
          "description": "Optional. Short abbreviation."
        },
        "name": {
          "type": "string",
          "description": "Optional. Full name."
        }
      }
    }
  }
}
