{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "gormo.de Status API v1",
  "type": "object",
  "required": [
    "schema_version",
    "timezone",
    "overall",
    "generated_at",
    "components",
    "incidents",
    "maintenance"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "timezone": {
      "const": "UTC"
    },
    "overall": {
      "type": "string",
      "enum": [
        "operational",
        "degraded",
        "outage",
        "maintenance",
        "unknown"
      ]
    },
    "generated_at": {
      "type": "integer"
    },
    "components": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "checked_at",
          "latency_ms",
          "history"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "operational",
              "degraded",
              "outage",
              "maintenance",
              "unknown"
            ]
          },
          "checked_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "latency_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "date",
                "status",
                "samples",
                "latency_ms"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "operational",
                    "degraded",
                    "outage",
                    "maintenance",
                    "unknown"
                  ]
                },
                "samples": {
                  "type": "integer",
                  "minimum": 0
                },
                "latency_ms": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    },
    "incidents": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "component",
          "title",
          "impact",
          "phase",
          "started_at",
          "resolved_at",
          "updates"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "component": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "impact": {
            "enum": [
              "degraded",
              "outage",
              "maintenance"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved"
            ]
          },
          "started_at": {
            "type": "integer"
          },
          "resolved_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "phase",
                "message",
                "created_at"
              ],
              "properties": {
                "phase": {
                  "type": "string",
                  "enum": [
                    "investigating",
                    "identified",
                    "monitoring",
                    "resolved"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "created_at": {
                  "type": "integer"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    },
    "maintenance": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "component",
          "title",
          "message",
          "starts_at",
          "ends_at",
          "state",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "component": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "starts_at": {
            "type": "integer"
          },
          "ends_at": {
            "type": "integer"
          },
          "state": {
            "enum": [
              "scheduled",
              "completed",
              "cancelled"
            ]
          },
          "created_at": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
