{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SocialScrape status document",
  "type": "object",
  "required": [
    "generated_at",
    "overall",
    "last_sweep",
    "platforms"
  ],
  "properties": {
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "overall": {
      "enum": [
        "operational",
        "degraded",
        "partial_outage",
        "major_outage",
        "no_data"
      ]
    },
    "last_sweep": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "required": [
            "finished_at",
            "ran",
            "failed"
          ],
          "properties": {
            "finished_at": {
              "type": "string",
              "format": "date-time"
            },
            "ran": {
              "type": "integer"
            },
            "failed": {
              "type": "integer"
            }
          }
        }
      ]
    },
    "platforms": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "platform",
          "status",
          "endpoints_total",
          "endpoints_failing",
          "uptime_pct_90d",
          "daily",
          "endpoints"
        ],
        "properties": {
          "platform": {
            "type": "string"
          },
          "status": {
            "enum": [
              "operational",
              "degraded",
              "partial_outage",
              "major_outage",
              "no_data"
            ]
          },
          "endpoints_total": {
            "type": "integer"
          },
          "endpoints_failing": {
            "type": "integer"
          },
          "uptime_pct_90d": {
            "type": [
              "number",
              "null"
            ]
          },
          "daily": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "date",
                "uptime_pct"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "uptime_pct": {
                  "type": "number"
                }
              }
            }
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "status",
                "checked_at",
                "latency_ms"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "operational",
                    "failing"
                  ]
                },
                "checked_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "latency_ms": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
