﻿{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.mpai.community/OSD/V1.4/data/BasicSpeechObject.json",
  "title": "BasicSpeechObject",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "Header": { "type": "string", "pattern": "^OSD-BSO-V[0-9]{1,2}[.][0-9]{1,2}$" },
    "MInstanceID": { "type": "string" },
    "BasicSpeechObjectID": { "type": "string" },

    "ParentObjects": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ParentObjectID": { "type": "string" },
          "ParentObjectSpaceTime": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          }
        },
        "required": ["ParentObjectID"]
      }
    },

    "ChildObjects": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ChildObjectID": { "type": "string" },
          "ChildObjectSpaceTime": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          }
        },
        "required": ["ChildObjectID"]
      }
    },

    "BasicSpeechObjectSpaceTime": {
      "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
    },

    "BasicSpeechData": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": { "Payload": { "type": "string" } },
            "required": ["Payload"]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "PayloadLength": { "type": "integer" },
              "PayloadDataURI": { "type": "string", "format": "uri" }
            },
            "required": ["PayloadDataURI"]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": { "ID": { "type": "string" } },
            "required": ["ID"]
          }
        ]
      }
    },

    "BasicSpeechDataQualifier": {
      "$ref": "https://schemas.mpai.community/TFA/V1.4/data/SpeechQualifier.json"
    },

    "BasicSpeechObjectAnnotations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "Annotation": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/Annotation.json"
          },
          "AnnotationTimeSpace": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          },
          "AnnotationRights": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "RightsIDOrRights": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "oneOf": [
                    { "type": "string", "description": "RightsID" },
                    { "$ref": "https://schemas.mpai.community/MMM4/V2.1/data/Rights.json" }
                  ]
                }
              }
            }
          }
        }
      }
    },

    "Rights": {
      "$ref": "https://schemas.mpai.community/MMM4/V2.1/data/Rights.json"
    },
    "DescrMetadata": { "type": "string" }
  },
  "required": ["Header", "BasicSpeechObjectID", "BasicSpeechObjectSpaceTime"]
}