{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Situation",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the situation."
    },
    "creationTime": {
      "type": "integer",
      "format": "int64",
      "description": "Unix timestamp of when this situation was created."
    },
    "reason": {
      "type": "string",
      "description": "Reason for the service alert, taken from TPEG codes."
    },
    "summary": {
      "type": "object",
      "properties": {
        "lang": {
          "type": "string",
          "description": "Language of the summary."
        },
        "value": {
          "type": "string",
          "description": "Short summary of the situation."
        }
      }
    },
    "description": {
      "type": "object",
      "properties": {
        "lang": {
          "type": "string",
          "description": "Language of the description."
        },
        "value": {
          "type": "string",
          "description": "Longer description of the situation."
        }
      }
    },
    "url": {
      "type": "object",
      "properties": {
        "lang": {
          "type": "string",
          "description": "Language of the URL."
        },
        "value": {
          "type": "string",
          "description": "URL for more information about the situation."
        }
      }
    },
    "activeWindows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "integer",
            "format": "int64",
            "description": "Start time of the active window as a Unix timestamp."
          },
          "to": {
            "type": "integer",
            "format": "int64",
            "description": "End time of the active window as a Unix timestamp."
          }
        }
      }
    },
    "allAffects": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "agencyId": {
            "type": "string",
            "description": "Identifier for the agency."
          },
          "applicationId": {
            "type": "string",
            "description": "Identifier for the application."
          },
          "directionId": {
            "type": "string",
            "description": "Identifier for the direction."
          },
          "routeId": {
            "type": "string",
            "description": "Identifier for the route."
          },
          "stopId": {
            "type": "string",
            "description": "Identifier for the stop."
          },
          "tripId": {
            "type": "string",
            "description": "Identifier for the trip."
          }
        }
      }
    },
    "consequences": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "condition": {
            "type": "string",
            "description": "Condition of the consequence."
          },
          "conditionDetails": {
            "type": "object",
            "properties": {
              "diversionPath": {
                "type": "object",
                "properties": {
                  "length": {
                    "type": "integer",
                    "description": "Length of the diversion path."
                  },
                  "levels": {
                    "type": "string",
                    "description": "Levels of the diversion path."
                  },
                  "points": {
                    "type": "string",
                    "description": "Points of the diversion path."
                  }
                }
              },
              "diversionStopIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "List of stop IDs affected by the diversion."
                }
              }
            }
          }
        }
      }
    },
    "publicationWindows": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/TimeWindow"
      }
    },
    "severity": {
      "type": "string",
      "description": "Severity of the situation."
    },
    "consequenceMessage": {
      "type": "string",
      "description": "Message regarding the consequence of the situation."
    }
  },
  "required": [
    "id",
    "creationTime"
  ]
}