{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kiduna.ai/schemas/isometric/scene.schema.json",
  "title": "Kiduna Isometric Scene",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "title", "realm", "purpose", "form", "dimension", "mode", "lifecycle", "environment", "camera", "lighting", "areas", "instances", "relationships", "permissions", "animation", "occlusionPolicy", "accessibility", "provenance"],
  "properties": {
    "id": { "type": "string", "pattern": "^scene\\.[a-z0-9.-]+$" },
    "title": { "type": "string" },
    "realm": { "type": "object", "additionalProperties": false, "required": ["id", "type"], "properties": { "id": { "type": "string" }, "type": { "enum": ["Ecosystem", "Organization", "Alliance", "Program", "Project", "Dyad", "Community", "Guild", "Institution", "Council", "Concept", "Cell", "Clan"] } } },
    "purpose": { "type": "string", "minLength": 10 },
    "form": { "enum": ["Literal Spatial", "Realistic", "Symbolic", "Impressionistic", "Diagrammatic", "Hybrid"] },
    "dimension": { "const": "2.5D" },
    "mode": { "enum": ["Development", "Rehearsal", "Live"] },
    "lifecycle": { "enum": ["Draft", "Published", "Superseded", "Retirement", "Retired"] },
    "environment": { "$ref": "#/$defs/environment" },
    "camera": { "$ref": "#/$defs/camera" },
    "lighting": { "$ref": "#/$defs/lighting" },
    "areas": { "type": "array", "items": { "$ref": "#/$defs/area" } },
    "instances": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/instance" } },
    "relationships": { "type": "array", "items": { "$ref": "#/$defs/relationship" } },
    "permissions": { "type": "array", "items": { "$ref": "#/$defs/permission" } },
    "animation": { "type": "array", "items": { "$ref": "#/$defs/sceneAnimation" } },
    "occlusionPolicy": { "$ref": "#/$defs/occlusionPolicy" },
    "overlays": { "type": "array", "items": { "$ref": "#/$defs/overlay" } },
    "accessibility": { "type": "object", "additionalProperties": false, "required": ["summary", "focusOrder", "reducedMotion", "spatialAlternative"], "properties": { "summary": { "type": "string" }, "focusOrder": { "type": "array", "items": { "type": "string" } }, "reducedMotion": { "type": "boolean" }, "spatialAlternative": { "type": "string" } } },
    "provenance": { "type": "object", "additionalProperties": false, "required": ["visualStatus", "image", "structuredBy", "canonVersion"], "properties": { "visualStatus": { "enum": ["supplied-primary-reference", "system-demonstration"] }, "image": { "type": "string", "pattern": "\\.png$" }, "structuredBy": { "type": "string" }, "canonVersion": { "type": "string" } } }
  },
  "$defs": {
    "vec3": { "type": "object", "additionalProperties": false, "required": ["x", "y", "z"], "properties": { "x": { "type": "number" }, "y": { "type": "number" }, "z": { "type": "number" } } },
    "environment": { "type": "object", "additionalProperties": false, "required": ["timeOfDay", "weather", "background", "terrain", "atmosphere"], "properties": { "timeOfDay": { "type": "string" }, "weather": { "type": "string" }, "background": { "$ref": "#/$defs/backgroundBinding" }, "terrain": { "type": "array", "items": { "type": "string" } }, "atmosphere": { "type": "string" } } },
    "backgroundBinding": { "type": "object", "additionalProperties": false, "required": ["componentId", "description", "horizonWU", "principalLightVector", "hazeProfile", "transitionBandWU", "connectionMethods", "reflectionProfile"], "properties": { "componentId": { "type": "string", "pattern": "^background\\." }, "description": { "type": "string" }, "horizonWU": { "type": "number", "minimum": 0 }, "principalLightVector": { "$ref": "#/$defs/vec3" }, "hazeProfile": { "type": "string" }, "transitionBandWU": { "type": "number", "exclusiveMinimum": 0 }, "connectionMethods": { "type": "array", "minItems": 2, "uniqueItems": true, "items": { "enum": ["architecture", "vegetation", "path", "shadow", "water", "atmosphere", "elevation"] } }, "reflectionProfile": { "type": "object", "additionalProperties": false, "required": ["warmth", "coolness"], "properties": { "warmth": { "type": "number", "minimum": 0, "maximum": 1 }, "coolness": { "type": "number", "minimum": 0, "maximum": 1 } } } } },
    "camera": { "type": "object", "additionalProperties": false, "required": ["projection", "tilePixels", "origin", "boundsWU", "safeFrame"], "properties": { "projection": { "const": "isometric-2:1" }, "tilePixels": { "type": "object", "additionalProperties": false, "required": ["width", "height"], "properties": { "width": { "const": 128 }, "height": { "const": 64 } } }, "origin": { "$ref": "#/$defs/vec3" }, "boundsWU": { "$ref": "#/$defs/vec3" }, "safeFrame": { "type": "number", "minimum": 0, "maximum": 0.25 } } },
    "lighting": { "type": "object", "additionalProperties": false, "required": ["ambient", "directional", "local", "rim", "reflection"], "properties": { "ambient": { "$ref": "#/$defs/light" }, "directional": { "$ref": "#/$defs/light" }, "local": { "type": "array", "items": { "$ref": "#/$defs/light" } }, "rim": { "$ref": "#/$defs/light" }, "reflection": { "type": "object", "additionalProperties": false, "required": ["warmth", "coolness"], "properties": { "warmth": { "type": "number", "minimum": 0, "maximum": 1 }, "coolness": { "type": "number", "minimum": 0, "maximum": 1 } } } } },
    "light": { "type": "object", "additionalProperties": false, "required": ["colorRole", "intensity"], "properties": { "colorRole": { "type": "string" }, "intensity": { "type": "number", "minimum": 0, "maximum": 1 }, "direction": { "$ref": "#/$defs/vec3" }, "rangeWU": { "type": "number", "exclusiveMinimum": 0 } } },
    "area": { "type": "object", "additionalProperties": false, "required": ["id", "name", "purpose", "instanceIds"], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "purpose": { "type": "string" }, "instanceIds": { "type": "array", "items": { "type": "string" } } } },
    "instance": { "type": "object", "additionalProperties": false, "required": ["id", "componentId", "position", "orientation", "scale", "state", "layer", "visible", "interactions"], "properties": { "id": { "type": "string" }, "componentId": { "type": "string" }, "position": { "$ref": "#/$defs/vec3" }, "elevationOffset": { "type": "number" }, "orientation": { "enum": ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "omnidirectional"] }, "scale": { "type": "number", "exclusiveMinimum": 0 }, "state": { "enum": ["idle", "available", "focused", "selected", "active", "occupied", "changed", "urgent", "completed", "locked", "unavailable", "new", "connected", "absent"] }, "layer": { "type": "integer", "minimum": 0, "maximum": 110 }, "visible": { "type": "boolean" }, "areaId": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } }, "interactions": { "type": "array", "items": { "type": "string" } }, "animation": { "type": "array", "items": { "$ref": "#/$defs/instanceAnimation" } }, "portalDestination": { "type": ["string", "null"] } } },
    "relationship": { "type": "object", "additionalProperties": false, "required": ["from", "to", "type", "visible"], "properties": { "from": { "type": "string" }, "to": { "type": "string" }, "type": { "enum": ["contains", "adjacent", "attached", "illuminates", "occludes", "connects", "faces", "serves"] }, "visible": { "type": "boolean" } } },
    "permission": { "type": "object", "additionalProperties": false, "required": ["id", "subject", "actions", "scope"], "properties": { "id": { "type": "string" }, "subject": { "type": "string" }, "actions": { "type": "array", "items": { "type": "string" } }, "scope": { "type": "string" } } },
    "sceneAnimation": { "type": "object", "additionalProperties": false, "required": ["id", "targets", "trigger", "loop", "durationMs", "amplitude", "channels", "interruptionPolicy", "reducedMotion"], "properties": { "id": { "type": "string" }, "targets": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "trigger": { "enum": ["ambient", "scene-enter", "scene-exit", "state-change", "event"] }, "loop": { "type": "boolean" }, "durationMs": { "type": "integer", "minimum": 80 }, "amplitude": { "type": "number", "minimum": 0 }, "channels": { "type": "array", "minItems": 1, "items": { "enum": ["position", "rotation", "scale", "opacity", "emission", "material", "particles", "sound"] } }, "interruptionPolicy": { "enum": ["finish", "blend", "snap", "cancel"] }, "reducedMotion": { "type": "string" } } },
    "instanceAnimation": { "type": "object", "additionalProperties": false, "required": ["clip", "playing", "speed"], "properties": { "clip": { "type": "string" }, "playing": { "type": "boolean" }, "speed": { "type": "number", "exclusiveMinimum": 0 } } },
    "occlusionPolicy": { "type": "object", "additionalProperties": false, "required": ["strategy", "focusOpacity", "transitionMs", "preserveSilhouette"], "properties": { "strategy": { "enum": ["selective-fade", "intelligent-cutaway", "silhouette", "hybrid"] }, "focusOpacity": { "type": "number", "minimum": 0, "maximum": 1 }, "transitionMs": { "type": "integer", "minimum": 0 }, "preserveSilhouette": { "type": "boolean" } } },
    "overlay": { "type": "object", "additionalProperties": false, "required": ["id", "type", "target", "visibility"], "properties": { "id": { "type": "string" }, "type": { "enum": ["label", "focus", "conversation", "status", "notification", "action", "offer", "realm-info", "entity-info", "navigation", "portal-preview"] }, "target": { "type": "string" }, "visibility": { "enum": ["always", "focus", "selection", "contextual"] } } }
  }
}
