{
  "type": "object",
  "properties": {
    "schema_version": {
      "const": "0.2"
    },
    "device": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]*$"
    },
    "at": {
      "type": "string",
      "format": "date-time"
    },
    "active": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_-]*(?:\\.[a-z0-9_-]+)+$"
      }
    },
    "weather": {
      "type": "object",
      "properties": {
        "temperature_2m": {
          "type": [
            "number",
            "null"
          ]
        },
        "apparent_temperature": {
          "type": [
            "number",
            "null"
          ]
        },
        "dew_point_2m": {
          "type": [
            "number",
            "null"
          ]
        },
        "wet_bulb_temperature_2m": {
          "type": [
            "number",
            "null"
          ]
        },
        "soil_temperature_0cm": {
          "type": [
            "number",
            "null"
          ]
        },
        "relative_humidity_2m": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "cloud_cover": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "cloud_cover_low": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "cloud_cover_mid": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "cloud_cover_high": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "precipitation_probability": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "pressure_msl": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "surface_pressure": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "visibility": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "wind_speed_10m": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "wind_gusts_10m": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "snow_depth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "shortwave_radiation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "direct_radiation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "diffuse_radiation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "uv_index": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "cape": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "wind_direction_10m": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "precipitation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "rain": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "showers": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "snowfall": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "sunshine_duration": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 3600
        },
        "freezing_level_height": {
          "type": [
            "number",
            "null"
          ]
        },
        "soil_moisture_0_to_1cm": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "is_day": {
          "type": [
            "integer",
            "null"
          ],
          "enum": [
            0,
            1,
            null
          ]
        },
        "weather_code": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 99
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "sun": {
      "type": "object",
      "properties": {
        "azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "daylight_duration": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 86400
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "derived": {
      "type": "object",
      "properties": {
        "pressure_change_3h": {
          "type": [
            "number",
            "null"
          ]
        },
        "temperature_change_3h": {
          "type": [
            "number",
            "null"
          ]
        },
        "life_slot": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 23,
          "description": "Server-decided local hour; null skips all life rules.",
          "readOnly": true
        },
        "activity_slot": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        },
        "activity_variant": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        },
        "activity_detail": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        },
        "lighting_slot": {
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "activity_seed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 2147483647
        },
        "scene_hour": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        },
        "visitor_roll": {
          "type": "integer",
          "minimum": 0,
          "maximum": 255
        },
        "calendar_active": {
          "type": "integer",
          "enum": [
            0,
            1
          ]
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "astro": {
      "type": "object",
      "properties": {
        "moon_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "moon_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "moon_illumination": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "moon_phase_angle": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "moon_distance_km": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "sun_longitude": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "darkness": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 4
        },
        "pleiades_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "pleiades_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "orion_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "orion_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "meteor_active_count": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "mercury_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "mercury_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "mercury_elongation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 180
        },
        "venus_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "venus_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "venus_elongation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 180
        },
        "mars_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "mars_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "mars_elongation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 180
        },
        "jupiter_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "jupiter_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "jupiter_elongation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 180
        },
        "saturn_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "saturn_azimuth": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "saturn_elongation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 180
        },
        "meteor_quadrantids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_lyrids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_eta_aquariids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_southern_delta_aquariids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_alpha_capricornids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_perseids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_draconids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_orionids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_southern_taurids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_northern_taurids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_leonids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_geminids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "meteor_ursids_radiant_elevation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        }
      },
      "additionalProperties": true
    },
    "astronomy": {
      "type": "object",
      "additionalProperties": true
    },
    "environment": {
      "type": "string",
      "minLength": 1
    },
    "space": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "station_sunlit_fraction": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "camera_sunlit_fraction": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "orbit_phase": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "earth_angular_radius": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 90
        },
        "moon_illumination": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "meteor_active_count": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "meteor_eligible_count": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "sun_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "sun_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "moon_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "moon_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "mercury_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "mercury_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "venus_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "venus_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "mars_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "mars_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "jupiter_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "jupiter_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "saturn_occulted": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "saturn_in_frame": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "space_scene": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "schema": {
          "type": "integer",
          "minimum": 1
        },
        "status": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "calendar": {
      "type": "object",
      "required": [
        "date",
        "timezone",
        "active_ids",
        "featured_id",
        "revision"
      ],
      "properties": {
        "date": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "timezone": {
          "type": "string"
        },
        "active_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "featured_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "revision": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": true
    }
  },
  "required": [
    "schema_version",
    "device",
    "at",
    "active"
  ],
  "additionalProperties": true,
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:imperial-school:dynamic-wallpaper-inputs:0.2",
  "allOf": [
    {
      "properties": {
        "active": {
          "contains": {
            "enum": [
              "season.spring",
              "season.summer",
              "season.autumn",
              "season.winter"
            ]
          },
          "minContains": 0,
          "maxContains": 1
        }
      }
    },
    {
      "properties": {
        "active": {
          "contains": {
            "enum": [
              "time.dawn",
              "time.day",
              "time.dusk",
              "time.night"
            ]
          },
          "minContains": 0,
          "maxContains": 1
        }
      }
    },
    {
      "properties": {
        "active": {
          "contains": {
            "enum": [
              "weather.clear",
              "weather.cloudy",
              "weather.fog",
              "weather.rain",
              "weather.snow",
              "weather.thunderstorm"
            ]
          },
          "minContains": 0,
          "maxContains": 1
        }
      }
    },
    {
      "properties": {
        "active": {
          "contains": {
            "enum": [
              "moon.new_moon",
              "moon.waxing_crescent",
              "moon.first_quarter",
              "moon.waxing_gibbous",
              "moon.full_moon",
              "moon.waning_gibbous",
              "moon.last_quarter",
              "moon.waning_crescent"
            ]
          },
          "minContains": 0,
          "maxContains": 1
        }
      }
    },
    {
      "properties": {
        "active": {
          "contains": {
            "enum": [
              "game.neutral",
              "game.playing",
              "game.achievement",
              "game.rare_achievement",
              "game.beaten",
              "game.completed",
              "game.mastered",
              "game.rank_drop"
            ]
          },
          "minContains": 0,
          "maxContains": 1
        }
      }
    }
  ]
}
