﻿{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.mpai.community/OSD/V1.4/data/3DModelObject.json",
  "title": "3DModelObject",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "Header": {
      "type": "string",
      "pattern": "^OSD-3MO-V[0-9]{1,2}[.][0-9]{1,2}$"
    },
    "MInstanceID": { "type": "string" },
    "3DModelObjectID": { "type": "string" },
    "3DModelObjectSpaceTime": {
      "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
    },
    "Basic3DModelObjectCount": { "type": "integer", "minimum": 0 },
    "Basic3DModelObjects": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "Basic3DModelObjectSpaceTime": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          },
          "Basic3DModelObjectIDOrBasic3DModelObject": {
            "type": "array",
            "items": {
              "oneOf": [
                { "$ref": "https://schemas.mpai.community/OSD/V1.4/data/Basic3DModelObject.json" },
                { "type": "string" }
              ]
            }
          },
          "3DModelObjectAnnotation": {
            "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"]
            }
          }
        },
        "required": ["Basic3DModelObjectSpaceTime", "Basic3DModelObjectIDOrBasic3DModelObject"]
      }
    },
    "Sub3DModelObjectCount": { "type": "integer", "minimum": 0 },
    "Sub3DModelObjects": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "Sub3DModelObjectSpaceTime": {
            "$ref": "https://schemas.mpai.community/OSD/V1.4/data/SpaceTime.json"
          },
          "Sub3DModelObjectIDOrSub3DModelObject": {
            "type": "array",
            "items": {
              "oneOf": [
                { "type": "string" },
                { "$ref": "https://schemas.mpai.community/OSD/V1.4/data/3DModelObject.json" }
              ]
            }
          },
          "Annotations": {
            "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"]
            }
          }
        },
        "required": ["Sub3DModelObjectSpaceTime", "Sub3DModelObjectIDOrSub3DModelObject"]
      }
    },
    "3DModelObjectOrBasic3DModelObject": {
      "type": "array",
      "items": {
        "oneOf": [
          { "$ref": "https://schemas.mpai.community/OSD/V1.4/data/Basic3DModelObject.json" },
          { "$ref": "https://schemas.mpai.community/OSD/V1.4/data/3DModelObject.json" }
        ]
      }
    },
    "Rights": {
      "$ref": "https://schemas.mpai.community/MMM4/V2.1/data/Rights.json"
    },
    "DescrMetadata": { "type": "string", "maxLength": 2048 }
  },
  "required": ["Header", "3DModelObjectID", "3DModelObjectSpaceTime"]
}