{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.landscapefederation.org.au/schema/built-environment/tla-usd-attributes.schema.json",
  "title": "TLA USD prim customData sidecar",
  "description": "JSON sidecar shape for USD prim customData — LOD mesh references, seasonal asset paths, and TLA-185 tracking metadata for real-time visualisation pipelines.",
  "type": "object",
  "required": ["usd", "prim", "mesh"],
  "properties": {
    "$schema": { "type": "string", "format": "uri" },
    "exporter": { "type": "string" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "usd": {
      "type": "object",
      "required": ["defaultPrim", "metersPerUnit", "upAxis"],
      "properties": {
        "defaultPrim": { "type": "string" },
        "metersPerUnit": { "type": "number", "minimum": 0 },
        "upAxis": { "type": "string", "enum": ["Y", "Z"] },
        "customLayerInfo": { "type": "object" }
      }
    },
    "prim": {
      "type": "object",
      "required": ["path", "type", "customData"],
      "properties": {
        "path": { "type": "string" },
        "type": { "type": "string" },
        "customData": {
          "type": "object",
          "required": ["tla"],
          "properties": {
            "tla": {
              "type": "object",
              "required": ["standardId", "assetId", "botanical", "delivery"],
              "properties": {
                "standardId": { "type": "string" },
                "federationSchemaVersion": { "type": "string" },
                "assetId": { "type": "string", "description": "TLA-185 field 185-110" },
                "fieldRefs": {
                  "type": "object",
                  "additionalProperties": { "type": "string" }
                },
                "botanical": {
                  "type": "object",
                  "properties": {
                    "scientificName": { "type": "string" },
                    "vernacularName": { "type": "string" },
                    "family": { "type": "string" },
                    "genus": { "type": "string" },
                    "taxonID": { "type": "string" }
                  }
                },
                "delivery": {
                  "type": "object",
                  "properties": {
                    "lod": {
                      "type": "string",
                      "enum": ["LOD 100", "LOD 200", "LOD 250", "LOD 300"],
                      "description": "TLA-185 field 185-170"
                    },
                    "representationProfile": {
                      "type": "string",
                      "description": "TLA-185 field 185-171"
                    }
                  }
                },
                "procedural": {
                  "type": "object",
                  "properties": {
                    "presetId": { "type": "string" },
                    "seed": { "type": ["integer", "null"] },
                    "engine": { "type": "string" }
                  }
                },
                "tracking": {
                  "type": "object",
                  "properties": {
                    "exportProfile": { "type": "string" },
                    "generatedAt": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          }
        },
        "references": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "assetPath": { "type": "string" },
              "purpose": { "type": "string" }
            }
          }
        }
      }
    },
    "mesh": {
      "type": "object",
      "required": ["lodMeshes"],
      "properties": {
        "lodMeshes": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["lod", "assetPath"],
            "properties": {
              "lod": { "type": "string" },
              "tlaFieldRef": { "type": "string" },
              "assetPath": { "type": "string" },
              "bounds": {
                "type": "object",
                "properties": {
                  "width_m": { "type": ["number", "null"] },
                  "height_m": { "type": ["number", "null"] },
                  "depth_m": { "type": ["number", "null"] }
                }
              }
            }
          }
        },
        "bounds": { "type": "object" },
        "metrics": { "type": "object" }
      }
    },
    "seasonalPaths": {
      "type": "object",
      "additionalProperties": { "type": "string" },
      "description": "Season-keyed USD asset paths (spring/summer/autumn/winter)."
    },
    "usdFileGeneration": {
      "type": "object",
      "properties": {
        "status": { "type": "string" },
        "note": { "type": "string" }
      }
    }
  },
  "additionalProperties": true
}
