{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://terminalweather.com/developers/schemas/webhook.schema.json",
  "title": "Terminal Weather webhook envelope preview",
  "description": "Non-production proposal for a signed Terminal Weather event delivery. Header names, signing procedure and retry policy remain subject to pilot review.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "delivery_id",
    "created_at",
    "signature",
    "event"
  ],
  "properties": {
    "schema": {
      "const": "terminal-weather.webhook.preview.v1"
    },
    "delivery_id": {
      "type": "string",
      "pattern": "^dlv_[A-Za-z0-9_-]{12,}$",
      "description": "Proposed idempotency key for a delivery attempt series."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "attempt": {
      "type": "integer",
      "minimum": 1
    },
    "signature": {
      "type": "object",
      "additionalProperties": false,
      "required": ["algorithm", "key_id", "timestamp"],
      "properties": {
        "algorithm": {
          "const": "HMAC-SHA256"
        },
        "key_id": {
          "type": "string",
          "minLength": 1
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "event": {
      "$ref": "https://terminalweather.com/developers/schemas/station-event.schema.json"
    }
  }
}
