{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sharedforest-com/json-schema/sharedforest-com-forest-snapshot-schema.json",
  "title": "ForestSnapshot",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sharedforest-com-openapi.json#/components/schemas/ForestSnapshot",
  "type": "object",
  "required": [
    "trees",
    "groves",
    "stats",
    "visitors",
    "uniqueVisitors",
    "generatedAt"
  ],
  "properties": {
    "trees": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tree"
      }
    },
    "groves": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Grove"
      }
    },
    "stats": {
      "$ref": "#/$defs/Stats"
    },
    "visitors": {
      "type": "integer"
    },
    "uniqueVisitors": {
      "type": "integer"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "truncated": {
      "type": "boolean",
      "description": "true when trees and groves hold only the chunks nearest the centre. GET /api/v1/chunks has the rest."
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Paginated responses only. Cursor for the next page, null on the last page."
    },
    "limit": {
      "type": "integer",
      "description": "Paginated responses only. Page size used."
    },
    "totalTrees": {
      "type": "integer",
      "description": "Paginated responses only. Trees that match bbox across all pages."
    }
  },
  "$defs": {
    "Grove": {
      "type": "object",
      "required": [
        "id",
        "x",
        "y",
        "level",
        "treesAbsorbed"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3
        },
        "treesAbsorbed": {
          "type": "integer"
        }
      }
    },
    "Stats": {
      "type": "object",
      "required": [
        "humans",
        "agents",
        "bots",
        "plantedToday"
      ],
      "properties": {
        "humans": {
          "type": "integer"
        },
        "agents": {
          "type": "integer"
        },
        "bots": {
          "type": "integer"
        },
        "plantedToday": {
          "type": "integer"
        }
      }
    },
    "Tree": {
      "type": "object",
      "required": [
        "id",
        "type",
        "x",
        "y",
        "plantedAt",
        "growthStage"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "sapling, pine, oak or blossom"
        },
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "plantedAt": {
          "type": "integer",
          "description": "ms since epoch"
        },
        "growthStage": {
          "type": "integer",
          "minimum": 0,
          "maximum": 5
        },
        "origin": {
          "type": "string",
          "enum": [
            "human",
            "agent"
          ]
        }
      }
    }
  }
}