{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.thecitynauts.com/mods/facades.schema.json",
  "title": "The Citynauts - facade mod (facades.json)",
  "description": "The facades.json of a facade mod: a zip with this file and three pictures per facade (facade_<name>_top / _floors / _ground .png, .jpg or .webp) next to it. Sizes are in pixels of the pictures. Guide: https://www.thecitynauts.com/mods/guide.html",
  "type": "object",
  "required": ["facades"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "This schema, for code editors (hover help, completion, checks). The game ignores it."
    },
    "title": {
      "type": "string",
      "maxLength": 60,
      "description": "The mod's name, shown in the game's User Mod popup. Optional; without it the zip's file name is used.",
      "examples": ["Old Town"]
    },
    "map": {
      "type": "string",
      "enum": ["roadmap", "satellite"],
      "default": "roadmap",
      "description": "The map the mod is shown on: the road map (like the Textured mode) or the satellite photo (like Fully Textured / Realistic). Optional, default \"roadmap\"."
    },
    "roofs": {
      "type": "string",
      "enum": ["flat", "photo"],
      "default": "flat",
      "description": "On the satellite map: roofs in one colour (\"flat\", like Fully Textured) or the satellite photo of the real roof (\"photo\", like Realistic). Optional, default \"flat\". On the road map the roofs are always the game's dark grey."
    },
    "roofColor": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$",
      "default": "#3b3e44",
      "description": "The flat roof colour on the satellite map, as #rrggbb. Optional, default \"#3b3e44\". Not used on the road map or with \"roofs\": \"photo\".",
      "examples": ["#3b3e44"]
    },
    "floorMetres": {
      "type": "number",
      "minimum": 2,
      "maximum": 6,
      "default": 3.1,
      "description": "How many metres one floor (floorRows pixels) is on the buildings: it sets the size the pictures are drawn at. Shared by all facades of the mod. Optional, default 3.1."
    },
    "facades": {
      "type": "array",
      "minItems": 1,
      "maxItems": 24,
      "description": "The facades of the mod (1 to 24). Each building gets one of them, picked by where it stands - always the same one, spread evenly.",
      "items": { "$ref": "#/definitions/facade" }
    }
  },
  "additionalProperties": true,
  "definitions": {
    "facade": {
      "type": "object",
      "required": ["name", "w", "top", "floors", "ground", "floorRows"],
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,40}$",
          "description": "Names the facade's pictures: facade_<name>_top, facade_<name>_floors, facade_<name>_ground (.png, .jpg, .jpeg or .webp). Letters, digits, _ and -, up to 40. Unique in the mod (letter case ignored).",
          "examples": ["brownstone"]
        },
        "w": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "description": "The width in pixels of all three pictures (they must be the same width). The pictures are repeated side by side along a wall at this size: w / floorRows * floorMetres metres."
        },
        "top": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "description": "The height in pixels of _top: the roof edge (cornice, parapet) and, under it, the building's last floor (floorRows pixels). Must be more than floorRows. Drawn once at the top of every wall; a low building gets only its roof-edge part."
        },
        "floors": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "description": "The height in pixels of _floors: whole floors, floorsInPart x floorRows. Repeated upwards between ground and top, as many floors as the building needs; its top and bottom edges must join."
        },
        "ground": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "description": "The height in pixels of _ground: the ground floor (doors, shop fronts, steps). Any height. Drawn once at the foot of every wall."
        },
        "floorRows": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "description": "The height of one floor in pixels, in all three pictures. It sets the scale: floorRows pixels = floorMetres metres. Must be less than top."
        },
        "floorsInPart": {
          "type": "integer",
          "minimum": 1,
          "maximum": 12,
          "default": 3,
          "description": "How many floors the _floors picture holds. Optional, default 3."
        }
      },
      "additionalProperties": true
    }
  }
}
