{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "legendEntry": {
      "description": "A single entry in a layer legend",
      "properties": {
        "color": {
          "description": "Color for this legend entry (e.g., '#FF5733')",
          "maxGraphemes": 16,
          "type": "string"
        },
        "label": {
          "description": "Display label for this legend entry",
          "maxGraphemes": 128,
          "type": "string"
        },
        "value": {
          "description": "Optional value associated with this legend entry",
          "maxGraphemes": 64,
          "type": "string"
        }
      },
      "required": [
        "label",
        "color"
      ],
      "type": "object"
    },
    "main": {
      "description": "A declaration of a layer for an organization",
      "key": "tid",
      "record": {
        "properties": {
          "bounds": {
            "description": "Bounding box as 'west,south,east,north'",
            "maxGraphemes": 128,
            "type": "string"
          },
          "category": {
            "description": "Layer category for grouping in UI (e.g., 'Biodiversity', 'Land Cover', 'Climate', 'Infrastructure')",
            "maxGraphemes": 128,
            "type": "string"
          },
          "colorScale": {
            "description": "Named color scale for continuous data",
            "knownValues": [
              "viridis",
              "plasma",
              "inferno",
              "magma",
              "cividis",
              "turbo",
              "spectral",
              "rdylgn",
              "rdylbu",
              "custom"
            ],
            "maxGraphemes": 64,
            "type": "string"
          },
          "createdAt": {
            "description": "The date and time of the creation of the record",
            "format": "datetime",
            "type": "string"
          },
          "dataDate": {
            "description": "Date of the data (ISO 8601)",
            "maxGraphemes": 64,
            "type": "string"
          },
          "dataSource": {
            "description": "Attribution/source of the layer data",
            "maxGraphemes": 512,
            "type": "string"
          },
          "description": {
            "description": "The description of the layer",
            "maxGraphemes": 2048,
            "type": "string"
          },
          "displayOrder": {
            "description": "Ordering priority for display",
            "minimum": 0,
            "type": "integer"
          },
          "isDefault": {
            "description": "Whether this layer should be shown by default",
            "type": "boolean"
          },
          "legend": {
            "description": "Legend entries for the layer",
            "items": {
              "ref": "#legendEntry",
              "type": "ref"
            },
            "maxLength": 20,
            "type": "array"
          },
          "maxValue": {
            "description": "Maximum value in the data range",
            "maxGraphemes": 32,
            "type": "string"
          },
          "minValue": {
            "description": "Minimum value in the data range",
            "maxGraphemes": 32,
            "type": "string"
          },
          "name": {
            "description": "The name of the site",
            "maxGraphemes": 256,
            "type": "string"
          },
          "opacity": {
            "description": "Default opacity (0-1 as string, e.g., '0.7')",
            "maxGraphemes": 8,
            "type": "string"
          },
          "propertyKey": {
            "description": "GeoJSON property key to use for choropleth coloring (e.g., 'species_richness')",
            "maxGraphemes": 128,
            "type": "string"
          },
          "siteRef": {
            "description": "AT-URI reference to the site this layer belongs to",
            "format": "at-uri",
            "type": "string"
          },
          "thumbnail": {
            "description": "Preview thumbnail for the layer",
            "ref": "app.gainforest.common.defs#imageThumbnail",
            "type": "ref"
          },
          "tileMaxZoom": {
            "description": "Maximum zoom level",
            "maximum": 22,
            "minimum": 0,
            "type": "integer"
          },
          "tileMinZoom": {
            "description": "Minimum zoom level",
            "maximum": 22,
            "minimum": 0,
            "type": "integer"
          },
          "tilePattern": {
            "description": "URL pattern for TMS tiles (e.g., 'https://tiles.example.com/{z}/{x}/{y}.png')",
            "maxGraphemes": 512,
            "type": "string"
          },
          "type": {
            "description": "The type of the layer",
            "enum": [
              "geojson_points",
              "geojson_points_trees",
              "geojson_line",
              "choropleth",
              "choropleth_shannon",
              "raster_tif",
              "tms_tile",
              "heatmap",
              "contour",
              "satellite_overlay"
            ],
            "maxGraphemes": 64,
            "type": "string"
          },
          "unit": {
            "description": "Unit of measurement for the layer data (e.g., 'species/ha', 'kg C/m²', 'mm/year')",
            "maxGraphemes": 64,
            "type": "string"
          },
          "uri": {
            "description": "The URI of the layer",
            "format": "uri",
            "maxGraphemes": 2048,
            "type": "string"
          }
        },
        "required": [
          "name",
          "type",
          "uri",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "app.gainforest.organization.layer",
  "lexicon": 1
}
