﻿
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.mpai.community/OSD/V1.4/data/BasicVisualObject.json",
  "title": "BasicVisualObject",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "Header": {
      "type": "string",
      "pattern": "^OSD-BVO-V[0-9]{1,2}[.][0-9]{1,2}$"
    },
    "MInstanceID": { "type": "string" },
    "BasicVisualObjectID": { "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"]
      }
    },

    "BasicVisualObjectSpaceTime": {
      "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
    },

    "BasicVisualObjectData": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "Data": { "type": "string", "contentEncoding": "base64" }
            },
            "required": ["Data"]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "DataLength": { "type": "integer", "minimum": 0 },
              "DataURI": { "type": "string", "format": "uri" }
            },
            "required": ["DataLength", "DataURI"]
          },
          {
            "type": "string",
            "description": "Plain string ID referencing external visual data"
          }
        ]
      }
    },

    "BasicVisualObjectProperties": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "PerceptStatus": { "type": "boolean" },
        "Resize": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "Rx": { "type": "number" },
            "Ry": { "type": "number" },
            "Rz": { "type": "number" }
          }
        },
        "Mass": { "type": "number" },
        "Material": { "type": "boolean" },
        "Gravity": { "type": "boolean" },
        "TextureMapOrMapID": {
          "type": "array",
          "items": {
            "oneOf": [
              { "$ref": "https://schemas.mpai.community/OSD/V1.4/data/TextureMap.json" },
              { "type": "string" }
            ]
          }
        },
        "ObjectAudioCharacteristics": {
          "$ref": "https://schemas.mpai.community/OSD/V1.4/data/ObjectAudioCharacteristics.json"
        },
        "EulerAngles": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "alpha": { "type": "number" },
            "beta": { "type": "number" },
            "gamma": { "type": "number" }
          }
        }
      }
    },

    "BasicVisualDataQualifier": {
      "$ref": "https://schemas.mpai.community/TFA/V1.4/data/VisualQualifier.json"
    },

    "BasicVisualObjectAnnotations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "Annotation": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/Annotation.json"
          },
          "AnnotationSpaceTime": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          },
          "AnnotationRights": {
            "type": "array",
            "items": {
              "oneOf": [
                { "$ref": "https://schemas.mpai.community/MMM4/V2.1/data/Rights.json" },
                { "type": "string" }
              ]
            }
          }
        },
        "required": ["Annotation"]
      }
    },

    "Rights": {
      "$ref": "https://schemas.mpai.community/MMM4/V2.1/data/Rights.json"
    },

    "DescrMetadata": { "type": "string", "maxLength": 2048 }
  },

  "required": ["Header", "BasicVisualObjectID", "BasicVisualObjectSpaceTime"]
}
