{ "$schema":                            "https://json-schema.org/draft/2020-12/schema",
  "$id":                                "https://schemas.mpai.community/OSD/V1.5/data/AudioSceneDescriptors.json",
  "title":                              "Audio Scene Descriptors V1.5",
  "type":                               "object",
  "additionalProperties":               false,
  "required":                           [ "Header", "AudioSceneDescriptorsID", "AudioSceneDescriptorsSpaceTime" ],
  "properties":                         {

    "Header":                           { "type": "string", "const": "OSD-ASD-V1.5" },
    "MInstanceID":                      { "type": "string", "description": "Identifier of the M-Instance (Virtual Space) where this Audio Scene is or is intended to be located." },
    "UEnvironmentID":                   { "type": "string", "description": "Identifier of the U-Environment (Real Space) where this Audio Scene is or is intended to be located." },
    "AudioSceneDescriptorsID":          { "type": "string", "description": "Unique identifier of this Audio Scene Descriptors instance." },
    "AudioSceneDescriptorsTime":        { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json",
                                          "description": "Time this Audio Scene Descriptors instance was produced." },

    "AudioSceneDescriptorsSpaceTime":   { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json",
                                          "description": "Space/Time where/when this Audio Scene Descriptors instance is located." },

    "AudioObjectCount":                 { "type": "integer", "minimum": 0, "description": "Number of Audio Objects in the Audio Scene." },

    "AudioObjects":                     { "type": "array", "minItems": 0, "description": "Set of Audio Objects in the Audio Scene.",
                                          "items": { "type": "object", "additionalProperties": false, "properties": {
      "AudioObjectSpaceTime":           { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json",
                                          "description": "Space/Time where/when this Audio Object is located within the Audio Scene." },
      "ObjectIDOrObject":               { "$ref": "#/$defs/ObjectIDOrObject", "description": "Either the ID of an Audio Object or the Audio Object itself." } } } },

    "SubAudioSceneCount":               { "type": "integer", "minimum": 0, "description": "Number of Audio Sub-Scenes in the Audio Scene." },

    "SubAudioScenes":                   { "type": "array", "minItems": 0, "description": "Set of Audio Sub-Scenes in the Audio Scene.",
                                          "items": { "type": "object", "additionalProperties": false, "properties": {
      "SubAudioSceneSpaceTime":         { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json",
                                          "description": "Space/Time where/when this Audio Sub-Scene is located within the Audio Scene." },
      "SubAudioSceneIDOrSubAudioScene": { "$ref": "#/$defs/SubAudioSceneIDOrSubAudioScene", "description": "Either the ID of an Audio Sub-Scene or the Audio Sub-Scene itself." } } } },

    "BasicAudioSceneOrAudioScene":      { "$ref": "#/$defs/BasicAudioSceneOrAudioScene", "description": "A mixed array of Basic Audio Scene Descriptors and Audio Scene Descriptors." },

    "DataXMData":                       { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json",
                                          "description": "MPAI-PTF Data Exchange Metadata providing provenance, authorisation, legal, security, and confidence information associated with this Audio Scene Descriptors instance in a trusted data exchange context." },
    "DescrMetadata":                    { "type": "string", "maxLength": 2048, "description": "Human-readable descriptive metadata of the Audio Scene Descriptors instance (plain text, max 2048 characters)." } },

  "$defs":                              {

    "ObjectIDOrObject":                 { "type": "array", "minItems": 1, "maxItems": 1, "items": { "oneOf": [
                                          { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/AudioObject.json" },
                                          { "type": "string" } ] } },

    "SubAudioSceneIDOrSubAudioScene":   { "type": "array", "minItems": 1, "maxItems": 1, "items": { "oneOf": [
                                          { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/AudioSceneDescriptors.json" },
                                          { "type": "string" } ] } },

    "BasicAudioSceneOrAudioScene":      { "type": "array", "items": { "oneOf": [
                                          { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/BasicAudioSceneDescriptors.json" },
                                          { "$ref": "#/$defs/BasicAudioSceneOrAudioScene" } ] } } } }
