{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.ruter.no/adt/ota/api/v3.0/pe/dpi/key_stops/dpi-key_stops.json",
  "type": "object",
  "title": "DpiKeyStops",
  "description": "This schema defines the Key Stops message sent as an MQTT message to vehicles",
  "required": [
    "eventTimestamp",
    "traceId",
    "id",
    "lineId",
    "linePublicCode",
    "stopPlaces"
  ],
  "additionalProperties": true,
  "properties": {
    "eventTimestamp": {
      "$id": "#/properties/eventTimestamp",
      "type": "string",
      "description": "As specified in the [ADT documentation.](https://adt.transhub.io)",
      "format": "date-time"
    },
    "traceId": {
      "$id": "#/properties/traceId",
      "type": "string",
      "description": "A unique identifier - UUID"
    },
    "id": {
      "$id": "#/properties/id",
      "type": "string",
      "examples": [
        "RUT:ServiceJourney:18-164036-22694106"
      ]
    },
    "lineId": {
      "$id": "#/properties/lineId",
      "type": "string",
      "examples": [
        "RUT:Line:18"
      ]
    },
    "linePublicCode": {
      "$id": "#/properties/linePublicCode",
      "type": "string",
      "examples": [
        "18"
      ]
    },
    "stopPlaces": {
      "$id": "#/properties/stopPlaces",
      "type": "array",
      "items": {
        "$id": "#/properties/stopPlaces/items",
        "title": "Items",
        "type": "object",
        "required": [
          "stopPlaceId",
          "stopPlaceIndex",
          "boarding",
          "alighting"
        ],
        "properties": {
          "stopPlaceId": {
            "$id": "#/properties/stopPlaces/items/stopPlaceId",
            "type": "string",
            "examples": [
              "NSR:StopPlace:3986"
            ]
          },
          "stopPlaceIndex": {
            "$id": "#/properties/stopPlaces/items/stopPlaceIndex",
            "type": "integer",
            "examples": [
              11
            ]
          },
          "boarding": {
            "$id": "#/properties/stopPlaces/items/boarding",
            "type": "object",
            "required": [
              "predictedValue",
              "qualityIndicator"
            ],
            "properties": {
              "predictedValue": {
                "$id": "#/properties/stopPlaces/items/boarding/predictedValue",
                "type": "number",
                "examples": [
                  1.4375
                ]
              },
              "qualityIndicator": {
                "$id": "#/properties/stopPlaces/items/boarding/qualityIndicator",
                "type": "string",
                "default": "",
                "examples": [
                  "GOOD",
                  "MEDIOCRE",
                  "UNKNOWN"
                ]
              }
            }
          },
          "alighting": {
            "$id": "#/properties/stopPlaces/items/alighting",
            "type": "object",
            "required": [
              "predictedValue",
              "qualityIndicator"
            ],
            "properties": {
              "predictedValue": {
                "$id": "#/properties/stopPlaces/items/alighting/predictedValue",
                "type": "number",
                "examples": [
                  0.4375
                ]
              },
              "qualityIndicator": {
                "$id": "#/properties/stopPlaces/items/alighting/qualityIndicator",
                "type": "string",
                "examples": [
                  "GOOD",
                  "MEDIOCRE",
                  "UNKNOWN"
                ]
              }
            }
          }
        }
      }
    }
  }
}
