{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://liftradar.eu/schema/index.schema.json",
  "$defs": {
    "Counts": {
      "additionalProperties": false,
      "properties": {
        "open": {
          "minimum": 0,
          "title": "Open",
          "type": "integer"
        },
        "total": {
          "minimum": 0,
          "title": "Total",
          "type": "integer"
        }
      },
      "required": [
        "open",
        "total"
      ],
      "title": "Counts",
      "type": "object"
    },
    "IndexAvalanche": {
      "additionalProperties": false,
      "properties": {
        "danger_level": {
          "anyOf": [
            {
              "maximum": 5,
              "minimum": 1,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Danger Level"
        },
        "danger": {
          "anyOf": [
            {
              "enum": [
                "low",
                "moderate",
                "considerable",
                "high",
                "very_high"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Danger"
        }
      },
      "required": [
        "danger_level",
        "danger"
      ],
      "title": "IndexAvalanche",
      "type": "object"
    },
    "IndexResort": {
      "additionalProperties": false,
      "description": "What the site's table, map and sources page read of a report; the rest is in the resort's own file.",
      "properties": {
        "id": {
          "pattern": "^[a-z0-9-]+$",
          "title": "Id",
          "type": "string"
        },
        "country": {
          "pattern": "^[a-z]{2}$",
          "title": "Country",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "region": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Region"
        },
        "location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "status": {
          "enum": [
            "open",
            "closed",
            "no_report"
          ],
          "title": "Status",
          "type": "string"
        },
        "checked_at": {
          "format": "date-time",
          "title": "Checked At",
          "type": "string"
        },
        "snow": {
          "$ref": "#/$defs/IndexSnow"
        },
        "lifts": {
          "anyOf": [
            {
              "$ref": "#/$defs/Counts"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "slopes": {
          "anyOf": [
            {
              "$ref": "#/$defs/SlopeCounts"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "avalanche": {
          "anyOf": [
            {
              "$ref": "#/$defs/IndexAvalanche"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "sources": {
          "items": {
            "type": "string"
          },
          "title": "Sources",
          "type": "array"
        }
      },
      "required": [
        "id",
        "country",
        "name",
        "region",
        "location",
        "status",
        "checked_at",
        "snow",
        "lifts",
        "slopes",
        "avalanche",
        "sources"
      ],
      "title": "IndexResort",
      "type": "object"
    },
    "IndexSnow": {
      "additionalProperties": false,
      "properties": {
        "mountain_cm": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Mountain Cm"
        },
        "valley_cm": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Valley Cm"
        },
        "fresh_cm": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fresh Cm"
        }
      },
      "required": [
        "mountain_cm",
        "valley_cm",
        "fresh_cm"
      ],
      "title": "IndexSnow",
      "type": "object"
    },
    "Location": {
      "additionalProperties": false,
      "description": "A point in the ski area (or its main village), for maps.",
      "properties": {
        "lat": {
          "maximum": 90,
          "minimum": -90,
          "title": "Lat",
          "type": "number"
        },
        "lon": {
          "maximum": 180,
          "minimum": -180,
          "title": "Lon",
          "type": "number"
        }
      },
      "required": [
        "lat",
        "lon"
      ],
      "title": "Location",
      "type": "object"
    },
    "SlopeCounts": {
      "additionalProperties": false,
      "description": "Slope counts plus kilometres, when the resort publishes every slope's length.\n\nCounts can be missing where only kilometres are published (SalzburgerLand).\nopen_km is rounded to 0.1 km and total_km up to a whole km, so the\nrounded open km never exceeds the rounded total.",
      "properties": {
        "open": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Open"
        },
        "total": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Total"
        },
        "open_km": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Open Km"
        },
        "total_km": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Total Km"
        }
      },
      "required": [
        "open",
        "total",
        "open_km",
        "total_km"
      ],
      "title": "SlopeCounts",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "const": "https://liftradar.eu/schema/index.schema.json",
      "default": "https://liftradar.eu/schema/index.schema.json",
      "title": "$Schema",
      "type": "string"
    },
    "generated_at": {
      "format": "date-time",
      "title": "Generated At",
      "type": "string"
    },
    "resorts": {
      "items": {
        "$ref": "#/$defs/IndexResort"
      },
      "title": "Resorts",
      "type": "array"
    }
  },
  "required": [
    "$schema",
    "generated_at",
    "resorts"
  ],
  "title": "Snow conditions for all resorts",
  "type": "object"
}
