{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.snowsure.ai/.well-known/schemas/resort-avalanche-v1.json",
  "title": "SnowSure Resort Avalanche Contract v1",
  "description": "The official avalanche bulletin for a resort's forecast zone, RELAYED by SnowSure. SnowSure does not issue avalanche forecasts: every response names the issuing warning service and links to the authoritative bulletin, and no field is a SnowSure judgement about terrain safety. `data` is null whenever no bulletin covers the resort (off-season, outside every forecast zone, or a country not yet mapped) — `meta.coverage` says which, and a null is honest absence, never an all-clear.",
  "type": "object",
  "required": ["schemaVersion", "schema", "meta", "data"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "type": "string", "const": "1.1.0" },
    "schema": { "type": "string", "format": "uri" },
    "meta": {
      "type": "object",
      "required": [
        "source",
        "slug",
        "generatedAt",
        "coverage",
        "coverageDetail",
        "issuer",
        "link",
        "relayed",
        "disclaimer"
      ],
      "additionalProperties": false,
      "properties": {
        "source": { "type": "string", "const": "SnowSure" },
        "slug": { "type": "string", "description": "Canonical resort slug (after alias resolution)." },
        "generatedAt": { "type": "string", "format": "date-time" },
        "coverage": {
          "type": "string",
          "enum": [
            "bulletin",
            "outside_forecast_zone",
            "no_current_bulletin",
            "country_not_covered",
            "location_unknown",
            "relay_not_permitted"
          ],
          "description": "Why `data` is or isn't populated. Branch on this rather than on `data === null`. `bulletin` is the only value with a non-null `data`. `no_current_bulletin` means the warning service published nothing (off-season or unreachable) and must NOT be read as low danger. `relay_not_permitted` means the issuer does not allow SnowSure to republish its bulletin: read it at `meta.link`."
        },
        "coverageDetail": {
          "type": "string",
          "description": "Human-readable expansion of `coverage`, safe to surface verbatim to an end user."
        },
        "issuer": {
          "oneOf": [{ "type": "string" }, { "type": "null" }],
          "description": "The authority behind this answer — the local forecast centre when a bulletin is attached, otherwise the national warning service. Null only when no service is mapped or the resort could not be located."
        },
        "link": {
          "oneOf": [{ "type": "string", "format": "uri" }, { "type": "null" }],
          "description": "Link to the official bulletin or warning service. Always surface this alongside any danger rating."
        },
        "relayed": {
          "type": "boolean",
          "const": true,
          "description": "Always true. This bulletin is relayed from its issuer, never authored by SnowSure."
        },
        "disclaimer": { "type": "string" }
      }
    },
    "data": {
      "oneOf": [
        { "type": "null" },
        {
          "type": "object",
          "required": [
            "slug",
            "source",
            "zoneName",
            "issuer",
            "link",
            "dangerRating",
            "dangerLabel",
            "travelAdvice",
            "validUntil",
            "offSeason"
          ],
          "additionalProperties": false,
          "properties": {
            "slug": { "type": "string" },
            "source": {
              "type": "string",
              "enum": ["US", "CA", "CH", "FR", "SE", "AT", "IT", "NO", "DE", "ES", "AD", "GB", "SK", "SI", "CZ"],
              "description": "Which national warning service issued this bulletin."
            },
            "zoneName": { "type": "string", "description": "Name of the forecast zone containing the resort." },
            "issuer": { "type": "string", "description": "The forecasting centre / warning service that issued this bulletin." },
            "link": { "type": "string", "format": "uri", "description": "The official bulletin. Always surface this." },
            "dangerRating": {
              "oneOf": [{ "type": "integer", "minimum": 1, "maximum": 5 }, { "type": "null" }],
              "description": "EAWS / North American 5-level danger scale. Null means the issuer published NO rating (spring, off-season, no-rating) — never a substituted or inferred value."
            },
            "dangerLabel": {
              "oneOf": [{ "type": "string" }, { "type": "null" }],
              "description": "EAWS 2018/19 English label: Low, Moderate, Considerable, High, Very high. Level 5 is Very high (North American centres often print Extreme for the same level). Null when there is no rating."
            },
            "travelAdvice": {
              "oneOf": [{ "type": "string" }, { "type": "null" }],
              "description": "The issuer's own travel advice or bulletin highlights, relayed verbatim. Null when the issuer published none."
            },
            "validUntil": {
              "oneOf": [{ "type": "string" }, { "type": "null" }],
              "description": "When this bulletin expires, as published by the issuer. Null when not published."
            },
            "offSeason": {
              "type": "boolean",
              "description": "True when the zone is outside its forecast season, or the issuer published no current rating."
            }
          }
        }
      ]
    }
  }
}
