{
  "$schema":                            "https://json-schema.org/draft/2020-12/schema",
  "$id":                                "https://schemas.mpai.community/OSD/V1.5/data/EnhancedVisualSceneDescriptors.json",
  "title":                              "Enhanced Visual Scene Descriptors V1.5", 
  "type":                               "object", 
  "additionalProperties":               false,
  "required":                           [ "Header", "MInstanceID", "EnhancedVisualSceneDescriptorsID", "BaseBVSID", 
                                          "EnhancedVisualSceneDescriptors" ], 
  "properties":                         {

    "Header":                           { "type": "string", "pattern": "^OSD-EVD-V[0-9]{1,2}[.][0-9]{1,2}$" },
    "MInstanceID":                      { "type": "string" },
    "UEnvironmentID":                   { "type": "string" },
    "EnhancedVisualSceneDescriptorsID": { "type": "string" },
    "BaseBVSID":                        { "type": "string" },
    "EnhancedVisualSceneDescriptorsSpaceTime": { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SpaceTime.json" },

    "EnhancedVisualSceneDescriptors":   { "type": "array", "items": { "type": "object", "additionalProperties": false, 
                                          "required": [ "EVDItemID", "BVSItemID" ], "properties": {
      "EVDItemID":                      { "type": "string" },
      "BVSItemID":                      { "type": "string" },
      "Depth":                          { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Depth.json" },
      "OcclusionFlag":                  { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/OcclusionFlag.json" },
      "Affordance":                     { "oneOf": [ 
                                        { "$ref": "#/$defs/VisualAffordanceItem" }, 
                                        { "$ref": "#/$defs/AudioAffordanceItem" }, 
                                        { "$ref": "#/$defs/HapticAffordanceItem" } ] },
      "InteractionPotential":           { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/InteractionPotential.json" },
      "Salience":                       { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SalienceScore.json" } } } },

    "DataXMData":                       { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":                    { "type": "string", "maxLength": 2048 } },

  "$defs":                        {
    "ConstraintItem":             { "type": "object", "additionalProperties": false, "required": [ "Reason" ], "properties": {
      "Reason":                   { "type": "string", "enum": [ "locked", "occluded", "out_of_reach", "safety_violation", 
                                                                "domain_rule", "muted", "out_of_range", "disabled" ] },
      "Severity":                 { "type": "string", "enum": [ "info", "warning", "error" ] } } },

    "VisualAffordanceItem":       { "type": "object", "additionalProperties": false, "required": [ "Tag", "Feasible", 
                                    "Confidence" ], "properties": {
      "Tag":                      { "type": "string", "enum": [ "Graspable", "Pushable", "Openable", "Rotatable", "Liftable", "Insertable", "Selectable" ] },
      "Feasible":                 { "type": "boolean" },
      "Constraints":              { "type": "array", "items": { "$ref": "#/$defs/ConstraintItem" } },
      "Referent":                 { "type": "string" },
      "Confidence":               { "type": "number", "minimum": 0.0, "maximum": 1.0 },
      "Compliance":               { "type": "string", "enum": [ "compliant", "violating", "unknown" ] },
      "FallbackApplied":          { "type": "boolean" },
      "FallbackTag":              { "type": "string", "enum": [ "Selectable" ] } } },

    "AudioAffordanceItem":        { "type": "object", "additionalProperties": false, "required": [ "Tag", "Feasible", "Confidence" ], "properties": {
      "Tag":                      { "type": "string", "enum": [ "AttentionCue", "Notification", "UrgencySignal", "InteractionPrompt" ] },
      "Feasible":                 { "type": "boolean" },
      "Constraints":              { "type": "array", "items": { "$ref": "#/$defs/ConstraintItem" } },
      "Referent":                 { "type": "string" },
      "AudioReferent":            { "type": "object", "additionalProperties": false, "properties": { "AudioObjectID": { "type": "string" }, "SceneDescriptorsID": { "type": "string" } } },
      "ChannelPolicy":            { "type": "string", "enum": [ "all", "music_only", "voice_only", "effects_only", "selected_channels" ] },
      "Confidence":               { "type": "number", "minimum": 0.0, "maximum": 1.0 },
      "Compliance":               { "type": "string", "enum": [ "compliant", "violating", "unknown" ] },
      "FallbackApplied":          { "type": "boolean" },
      "FallbackTag":              { "type": "string", "enum": [ "Notification" ] } } },

    "HapticAffordanceItem":       { "type": "object", "additionalProperties": false, "required": [ "Tag", "Feasible", 
                                    "Confidence" ], "properties": {
      "Tag":                      { "type": "string", "enum": [ "Touchable", "Tappable", "Draggable", "PressureSensitive", 
                                    "VibratoryCue" ] },
      "Feasible":                 { "type": "boolean" },
      "Constraints":              { "type": "array", "items": { "$ref": "#/$defs/ConstraintItem" } },
      "Referent":                 { "type": "string" },
      "Confidence":               { "type": "number", "minimum": 0.0, "maximum": 1.0 },
      "Compliance":               { "type": "string", "enum": [ "compliant", "violating", "unknown" ] },
      "FallbackApplied":          { "type": "boolean" },
      "FallbackTag":              { "type": "string", "enum": [ "Touchable" ] } } } } } 