{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://stormstream.io/schema/stormevent.json",
  "title": "StormEvent",
  "description": "StormEvent is an open, versioned shape for severe-weather events, published by Storm Stream as an open standard. Adopt it freely in your own APIs, feeds, and storage. Geometry fields (track, swath) are arrays of [lat,lng] pairs; when Storm Stream emits GeoJSON it converts to [lng,lat] per RFC 7946.",
  "type": "object",
  "required": ["id", "name", "type", "severity", "confidence", "at", "swath", "source"],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable unique event id.",
      "minLength": 1
    },
    "name": {
      "type": "string",
      "description": "Human-readable event name.",
      "minLength": 1
    },
    "type": {
      "type": "string",
      "enum": ["hail", "wind"],
      "description": "Event kind."
    },
    "maxHail": {
      "type": "number",
      "minimum": 0,
      "description": "Maximum hail size in inches. Present for hail events."
    },
    "gust": {
      "type": "integer",
      "minimum": 0,
      "description": "Peak wind gust in mph. Present for wind events."
    },
    "severity": {
      "type": "string",
      "enum": ["moderate", "severe", "extreme"],
      "description": "Impact tier."
    },
    "confidence": {
      "type": "integer",
      "minimum": 0,
      "maximum": 99,
      "description": "Detection confidence, 0 to 99."
    },
    "color": {
      "type": "string",
      "description": "Suggested display color, hex string, for example #FFB300."
    },
    "at": {
      "type": "integer",
      "description": "Event time, unix epoch milliseconds."
    },
    "track": {
      "type": "array",
      "description": "Storm center track as [lat,lng] pairs.",
      "items": { "$ref": "#/$defs/latLng" }
    },
    "swath": {
      "type": "array",
      "description": "Impact swath polygon ring as [lat,lng] pairs.",
      "items": { "$ref": "#/$defs/latLng" },
      "minItems": 3
    },
    "areaKm2": {
      "type": "number",
      "minimum": 0,
      "description": "Swath area in square kilometers."
    },
    "source": {
      "type": "string",
      "description": "Primary data source identifier.",
      "minLength": 1
    },
    "sources": {
      "type": "array",
      "description": "Source URLs backing the detection.",
      "items": { "type": "string", "format": "uri" }
    }
  },
  "$defs": {
    "latLng": {
      "type": "array",
      "description": "A [lat,lng] pair: latitude then longitude.",
      "prefixItems": [
        { "type": "number", "minimum": -90, "maximum": 90 },
        { "type": "number", "minimum": -180, "maximum": 180 }
      ],
      "items": false,
      "minItems": 2,
      "maxItems": 2
    }
  }
}
