{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://recit.dev/schema/v1/map-block.json",
  "x-recit-stability": "preview",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "const": "map"
    },
    "region": {
      "default": "world",
      "anyOf": [
        {
          "type": "string",
          "const": "world"
        },
        {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        {
          "type": "array",
          "prefixItems": [
            {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          ],
          "items": false,
          "minItems": 4,
          "maxItems": 4
        }
      ]
    },
    "level": {
      "default": "admin0",
      "type": "string",
      "enum": [
        "admin0",
        "admin1"
      ]
    },
    "projection": {
      "type": "string",
      "enum": [
        "equal-earth",
        "natural-earth",
        "mercator",
        "conic-conformal",
        "albers",
        "albers-usa",
        "orthographic",
        "azimuthal-equal-area"
      ]
    },
    "labels": {
      "type": "string",
      "enum": [
        "none",
        "short",
        "auto"
      ]
    },
    "legend": {
      "type": "string",
      "enum": [
        "below",
        "side"
      ]
    },
    "insets": {
      "type": "string",
      "enum": [
        "auto",
        "none"
      ]
    },
    "worldview": {
      "type": "string",
      "enum": [
        "AR",
        "BD",
        "BR",
        "CN",
        "DE",
        "EG",
        "ES",
        "FR",
        "GB",
        "GR",
        "ID",
        "IL",
        "IN",
        "IT",
        "JP",
        "KR",
        "MA",
        "NL",
        "NP",
        "PK",
        "PL",
        "PS",
        "PT",
        "RU",
        "SA",
        "SE",
        "TR",
        "TW",
        "UA",
        "US",
        "VN"
      ]
    },
    "tiles": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "liberty",
            "positron",
            "bright"
          ]
        },
        {
          "type": "string",
          "pattern": "^(https:\\/\\/|\\/(?![/\\\\])|\\.\\/)\\S+\\.json$"
        }
      ]
    },
    "attribution": {
      "type": "string",
      "minLength": 1
    },
    "caption": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        }
      ]
    },
    "source": {
      "type": "string"
    },
    "height": {
      "type": "integer",
      "minimum": 120,
      "maximum": 2000
    },
    "mode": {
      "type": "string",
      "enum": [
        "choropleth",
        "points",
        "route",
        "tiles"
      ]
    },
    "data": {
      "type": "string"
    },
    "key": {
      "type": "string"
    },
    "value": {
      "type": "string"
    },
    "scheme": {
      "type": "string",
      "enum": [
        "sequential",
        "diverging"
      ]
    },
    "layers": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "marker"
              },
              "lat": {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              "lon": {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              },
              "label": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              }
            },
            "required": [
              "type",
              "lat",
              "lon"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "route"
              },
              "from": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "number",
                        "minimum": -90,
                        "maximum": 90
                      },
                      {
                        "type": "number",
                        "minimum": -180,
                        "maximum": 180
                      }
                    ],
                    "items": false,
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              },
              "to": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "number",
                        "minimum": -90,
                        "maximum": 90
                      },
                      {
                        "type": "number",
                        "minimum": -180,
                        "maximum": 180
                      }
                    ],
                    "items": false,
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              },
              "style": {
                "type": "string",
                "enum": [
                  "solid",
                  "dashed",
                  "dotted"
                ]
              },
              "reveal": {
                "type": "string",
                "enum": [
                  "draw",
                  "fade",
                  "none"
                ]
              },
              "label": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              }
            },
            "required": [
              "type",
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "area"
              },
              "src": {
                "type": "string",
                "minLength": 1
              },
              "reveal": {
                "type": "string",
                "enum": [
                  "draw",
                  "fade",
                  "none"
                ]
              },
              "label": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              }
            },
            "required": [
              "type",
              "src"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "geojson"
              },
              "data": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "label": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              }
            },
            "required": [
              "type",
              "data"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "type"
  ],
  "additionalProperties": false
}
