{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://snow.miron.asia/schema/resort.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"
    },
    "SlopeCounts": {
      "additionalProperties": false,
      "description": "Slope counts plus kilometres, when the resort publishes every slope's length.",
      "properties": {
        "open": {
          "minimum": 0,
          "title": "Open",
          "type": "integer"
        },
        "total": {
          "minimum": 0,
          "title": "Total",
          "type": "integer"
        },
        "open_km": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Open Km"
        },
        "total_km": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Total Km"
        }
      },
      "required": [
        "open",
        "total"
      ],
      "title": "SlopeCounts",
      "type": "object"
    },
    "Snow": {
      "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"
        },
        "last_snowfall": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Last Snowfall"
        },
        "condition": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Condition"
        },
        "stations": {
          "items": {
            "$ref": "#/$defs/Station"
          },
          "title": "Stations",
          "type": "array"
        }
      },
      "title": "Snow",
      "type": "object"
    },
    "Station": {
      "additionalProperties": false,
      "description": "A snow measuring point published by the resort.",
      "properties": {
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "elevation_m": {
          "anyOf": [
            {
              "maximum": 5000,
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Elevation M"
        },
        "depth_cm": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Depth Cm"
        },
        "fresh_cm": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fresh Cm"
        },
        "temperature_c": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Temperature C"
        },
        "condition": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Condition"
        }
      },
      "required": [
        "name"
      ],
      "title": "Station",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "id": {
      "pattern": "^[a-z0-9-]+$",
      "title": "Id",
      "type": "string"
    },
    "name": {
      "minLength": 1,
      "title": "Name",
      "type": "string"
    },
    "fetched_at": {
      "format": "date-time",
      "title": "Fetched At",
      "type": "string"
    },
    "snow": {
      "$ref": "#/$defs/Snow"
    },
    "lifts": {
      "anyOf": [
        {
          "$ref": "#/$defs/Counts"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "slopes": {
      "anyOf": [
        {
          "$ref": "#/$defs/SlopeCounts"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "lifts_updated_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lifts Updated At"
    },
    "sources": {
      "items": {
        "type": "string"
      },
      "title": "Sources",
      "type": "array"
    },
    "errors": {
      "items": {
        "type": "string"
      },
      "title": "Errors",
      "type": "array"
    }
  },
  "required": [
    "id",
    "name",
    "fetched_at"
  ],
  "title": "Snow conditions for one resort",
  "type": "object"
}
