{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:animsmith:schema:measurements:18",
  "title": "animsmith measurements v18",
  "description": "Animation measurements including artifact-derived per-bone TRS channel coverage, sampled normalized-model-space Root/Hips trajectory evidence, loop endpoint and declared frame-grid evidence, explicit per-bone loop-continuity availability, per-primitive finite geometry summaries, bounded unsupported-image magic evidence, plus static scene-bound, source material-resource, and source skeleton/rest-pose transform-domain measurements shared by measure and lint output. Every clip fact that is not applicable to every clip carries a sibling `_availability` status distinguishing `not_applicable` (this clip has no subject for the fact) from `unavailable` (the subject applies, but derivation failed); the value field is present exactly when that status is `measured`.",
  "type": "object",
  "required": [
    "schema_version",
    "schema",
    "clips",
    "material_resource_coverage",
    "material_definitions",
    "textures",
    "images",
    "mesh_definitions",
    "node_instances",
    "scenes",
    "skeleton_source_coverage",
    "skeleton_nodes",
    "skins"
  ],
  "properties": {
    "schema_version": {
      "const": 18
    },
    "schema": {
      "const": "urn:animsmith:schema:measurements:18"
    },
    "clips": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/clip_measurements"
      }
    },
    "material_resource_coverage": {
      "enum": [
        "complete",
        "unavailable"
      ]
    },
    "material_definitions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/material_definition"
      }
    },
    "textures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/texture"
      }
    },
    "images": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/image"
      }
    },
    "mesh_definitions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/mesh_definition"
      }
    },
    "node_instances": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/node_instance"
      }
    },
    "scenes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/scene"
      }
    },
    "default_scene_index": {
      "type": "integer",
      "minimum": 0
    },
    "skeleton_source_coverage": {
      "enum": [
        "complete",
        "unavailable"
      ]
    },
    "skeleton_nodes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/skeleton_node"
      }
    },
    "skins": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/skin"
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "material_resource_coverage": {
            "const": "unavailable"
          }
        },
        "required": [
          "material_resource_coverage"
        ]
      },
      "then": {
        "properties": {
          "material_definitions": {
            "maxItems": 0
          },
          "textures": {
            "maxItems": 0
          },
          "images": {
            "maxItems": 0
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "skeleton_source_coverage": {
            "const": "unavailable"
          }
        },
        "required": [
          "skeleton_source_coverage"
        ]
      },
      "then": {
        "properties": {
          "skeleton_nodes": {
            "maxItems": 0
          },
          "skins": {
            "maxItems": 0
          }
        }
      }
    }
  ],
  "$defs": {
    "measurement_availability": {
      "enum": [
        "measured",
        "not_applicable",
        "unavailable"
      ]
    },
    "clip_measurements": {
      "type": "object",
      "required": [
        "duration_s",
        "frame_count",
        "animated_bones",
        "bone_channels",
        "bone_rotation_range_deg",
        "loop_continuity_availability",
        "loop_endpoint_mode_availability",
        "frame_grid_availability",
        "loop_seam_ratio_availability",
        "gait_availability",
        "root_trajectory_availability",
        "speed_mps_availability"
      ],
      "properties": {
        "duration_s": {
          "type": "number"
        },
        "frame_count": {
          "type": "integer",
          "minimum": 0
        },
        "animated_bones": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string"
          }
        },
        "bone_channels": {
          "type": "array",
          "uniqueItems": true,
          "description": "Canonical set of non-empty local TRS channels present in the measured document, grouped by skeleton bone index. This describes artifact coverage, not requested transforms, removed-track evidence, or track multiplicity.",
          "items": {
            "$ref": "#/$defs/bone_channels"
          }
        },
        "bone_rotation_range_deg": {
          "type": "object",
          "description": "Maximum rotation deviation for structurally valid keyed rotation channels above the recording floor. Every key is also present in animated_bones; that cross-field invariant is enforced by the core contract validator.",
          "additionalProperties": {
            "type": "number"
          }
        },
        "loop_continuity": {
          "$ref": "#/$defs/loop_continuity"
        },
        "loop_continuity_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "loop_endpoint_mode": {
          "enum": [
            "unique_cycle",
            "duplicate_endpoint",
            "non_closing"
          ]
        },
        "loop_endpoint_mode_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "frame_grid": {
          "$ref": "#/$defs/frame_grid"
        },
        "frame_grid_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "loop_seam_ratio": {
          "type": "number"
        },
        "loop_seam_ratio_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "gait": {
          "$ref": "#/$defs/gait"
        },
        "gait_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "root_trajectory": {
          "$ref": "#/$defs/root_trajectory"
        },
        "root_trajectory_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "speed_mps": {
          "type": "number"
        },
        "speed_mps_availability": {
          "$ref": "#/$defs/measurement_availability"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "loop_continuity_availability": {
                "const": "measured"
              }
            },
            "required": [
              "loop_continuity_availability"
            ]
          },
          "then": {
            "required": [
              "loop_continuity"
            ]
          },
          "else": {
            "not": {
              "required": [
                "loop_continuity"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "loop_endpoint_mode_availability": {
                "const": "measured"
              }
            },
            "required": [
              "loop_endpoint_mode_availability"
            ]
          },
          "then": {
            "required": [
              "loop_endpoint_mode"
            ]
          },
          "else": {
            "not": {
              "required": [
                "loop_endpoint_mode"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "frame_grid_availability": {
                "const": "measured"
              }
            },
            "required": [
              "frame_grid_availability"
            ]
          },
          "then": {
            "required": [
              "frame_grid"
            ]
          },
          "else": {
            "not": {
              "required": [
                "frame_grid"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "loop_seam_ratio_availability": {
                "const": "measured"
              }
            },
            "required": [
              "loop_seam_ratio_availability"
            ]
          },
          "then": {
            "required": [
              "loop_seam_ratio"
            ]
          },
          "else": {
            "not": {
              "required": [
                "loop_seam_ratio"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "gait_availability": {
                "const": "measured"
              }
            },
            "required": [
              "gait_availability"
            ]
          },
          "then": {
            "required": [
              "gait"
            ]
          },
          "else": {
            "not": {
              "required": [
                "gait"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "root_trajectory_availability": {
                "const": "measured"
              }
            },
            "required": [
              "root_trajectory_availability"
            ]
          },
          "then": {
            "required": [
              "root_trajectory"
            ]
          },
          "else": {
            "not": {
              "required": [
                "root_trajectory"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "speed_mps_availability": {
                "const": "measured"
              }
            },
            "required": [
              "speed_mps_availability"
            ]
          },
          "then": {
            "required": [
              "speed_mps"
            ]
          },
          "else": {
            "not": {
              "required": [
                "speed_mps"
              ]
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "bone_channels": {
      "type": "object",
      "required": [
        "bone_index",
        "bone_name",
        "properties"
      ],
      "properties": {
        "bone_index": {
          "type": "integer",
          "minimum": 0
        },
        "bone_name": {
          "type": "string"
        },
        "properties": {
          "description": "Non-empty canonical subset in translation, rotation, scale order.",
          "enum": [
            [
              "translation"
            ],
            [
              "rotation"
            ],
            [
              "scale"
            ],
            [
              "translation",
              "rotation"
            ],
            [
              "translation",
              "scale"
            ],
            [
              "rotation",
              "scale"
            ],
            [
              "translation",
              "rotation",
              "scale"
            ]
          ]
        }
      },
      "additionalProperties": false
    },
    "gait": {
      "type": "object",
      "required": [
        "lr_amplitude_m",
        "phase_availability"
      ],
      "properties": {
        "phase": {
          "type": "number"
        },
        "phase_availability": {
          "$ref": "#/$defs/measurement_availability"
        },
        "lr_amplitude_m": {
          "type": "number"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "phase_availability": {
                "const": "measured"
              }
            },
            "required": [
              "phase_availability"
            ]
          },
          "then": {
            "required": [
              "phase"
            ]
          },
          "else": {
            "not": {
              "required": [
                "phase"
              ]
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "root_trajectory": {
      "type": "object",
      "required": [
        "bone_index",
        "bone_name",
        "source_role",
        "translation_availability",
        "yaw_availability"
      ],
      "properties": {
        "bone_index": {
          "type": "integer",
          "minimum": 0
        },
        "bone_name": {
          "type": "string"
        },
        "source_role": {
          "enum": [
            "root",
            "hips_fallback"
          ]
        },
        "translation": {
          "$ref": "#/$defs/root_translation"
        },
        "translation_availability": {
          "enum": [
            "measured",
            "unavailable"
          ]
        },
        "yaw": {
          "$ref": "#/$defs/root_yaw"
        },
        "yaw_availability": {
          "enum": [
            "measured",
            "unavailable"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "translation_availability": {
                "const": "measured"
              }
            },
            "required": [
              "translation_availability"
            ]
          },
          "then": {
            "required": [
              "translation"
            ]
          },
          "else": {
            "not": {
              "required": [
                "translation"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "yaw_availability": {
                "const": "measured"
              }
            },
            "required": [
              "yaw_availability"
            ]
          },
          "then": {
            "required": [
              "yaw"
            ]
          },
          "else": {
            "not": {
              "required": [
                "yaw"
              ]
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "root_translation": {
      "type": "object",
      "required": [
        "horizontal_displacement_x_m",
        "horizontal_displacement_z_m",
        "horizontal_travel_m",
        "vertical_displacement_m",
        "vertical_min_displacement_m",
        "vertical_max_displacement_m"
      ],
      "properties": {
        "horizontal_displacement_x_m": {
          "type": "number"
        },
        "horizontal_displacement_z_m": {
          "type": "number"
        },
        "horizontal_travel_m": {
          "type": "number",
          "minimum": 0
        },
        "vertical_displacement_m": {
          "type": "number"
        },
        "vertical_min_displacement_m": {
          "type": "number",
          "maximum": 0
        },
        "vertical_max_displacement_m": {
          "type": "number",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "root_yaw": {
      "type": "object",
      "required": [
        "heading_axis",
        "net_yaw_deg",
        "unwrapped_yaw_deg",
        "yaw_travel_deg"
      ],
      "properties": {
        "heading_axis": {
          "enum": [
            "positive_z",
            "positive_y",
            "positive_x"
          ]
        },
        "net_yaw_deg": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        },
        "unwrapped_yaw_deg": {
          "type": "number"
        },
        "yaw_travel_deg": {
          "type": "number",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "frame_grid": {
      "type": "object",
      "required": [
        "fps",
        "frame_intervals"
      ],
      "properties": {
        "fps": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "frame_intervals": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "loop_continuity": {
      "type": "object",
      "required": [
        "bones"
      ],
      "properties": {
        "bones": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/bone_loop_continuity"
          }
        }
      },
      "additionalProperties": false
    },
    "bone_loop_continuity": {
      "type": "object",
      "required": [
        "bone_index",
        "bone_name",
        "availability"
      ],
      "properties": {
        "bone_index": {
          "type": "integer",
          "minimum": 0
        },
        "bone_name": {
          "type": "string"
        },
        "availability": {
          "enum": [
            "measured",
            "unavailable"
          ]
        },
        "position_delta_m": {
          "type": "number",
          "minimum": 0
        },
        "rotation_delta_deg": {
          "type": "number",
          "minimum": 0
        },
        "seam_velocity_delta_mps": {
          "type": "number",
          "minimum": 0
        },
        "seam_angular_velocity_delta_degps": {
          "type": "number",
          "minimum": 0
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "availability": {
                "const": "measured"
              }
            },
            "required": [
              "availability"
            ]
          },
          "then": {
            "required": [
              "position_delta_m",
              "rotation_delta_deg",
              "seam_velocity_delta_mps",
              "seam_angular_velocity_delta_degps"
            ]
          },
          "else": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "position_delta_m"
                  ]
                },
                {
                  "required": [
                    "rotation_delta_deg"
                  ]
                },
                {
                  "required": [
                    "seam_velocity_delta_mps"
                  ]
                },
                {
                  "required": [
                    "seam_angular_velocity_delta_degps"
                  ]
                }
              ]
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "mesh_definition": {
      "type": "object",
      "required": [
        "mesh_index",
        "name",
        "primitives",
        "vertex_count",
        "max_joints_per_vertex",
        "additional_influence_sets"
      ],
      "properties": {
        "mesh_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "primitives": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/primitive_measurements"
          }
        },
        "vertex_count": {
          "type": "integer",
          "minimum": 0
        },
        "geometry_aabb": {
          "$ref": "#/$defs/aabb"
        },
        "geometry_centroid": {
          "$ref": "#/$defs/vec3"
        },
        "max_joints_per_vertex": {
          "type": "integer",
          "minimum": 0
        },
        "weight_sum_min": {
          "type": "number"
        },
        "weight_sum_max": {
          "type": "number"
        },
        "additional_influence_sets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/additional_influence_set"
          }
        }
      },
      "additionalProperties": false
    },
    "primitive_measurements": {
      "type": "object",
      "required": [
        "primitive_index",
        "material_index",
        "vertex_count",
        "finite_vertex_count"
      ],
      "properties": {
        "primitive_index": {
          "type": "integer",
          "minimum": 0
        },
        "material_index": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "vertex_count": {
          "type": "integer",
          "minimum": 0
        },
        "finite_vertex_count": {
          "type": "integer",
          "minimum": 0
        },
        "geometry_aabb": {
          "$ref": "#/$defs/aabb"
        },
        "geometry_centroid": {
          "$ref": "#/$defs/vec3"
        }
      },
      "oneOf": [
        {
          "properties": {
            "finite_vertex_count": {
              "const": 0
            }
          },
          "not": {
            "anyOf": [
              {
                "required": [
                  "geometry_aabb"
                ]
              },
              {
                "required": [
                  "geometry_centroid"
                ]
              }
            ]
          }
        },
        {
          "properties": {
            "finite_vertex_count": {
              "minimum": 1
            }
          },
          "required": [
            "geometry_aabb",
            "geometry_centroid"
          ]
        }
      ],
      "additionalProperties": false
    },
    "additional_influence_set": {
      "type": "object",
      "required": [
        "set_index",
        "joints_present",
        "weights_present",
        "joints_without_weights_present",
        "weights_without_joints_present"
      ],
      "properties": {
        "set_index": {
          "type": "integer",
          "minimum": 1
        },
        "joints_present": {
          "type": "boolean"
        },
        "weights_present": {
          "type": "boolean"
        },
        "joints_without_weights_present": {
          "type": "boolean"
        },
        "weights_without_joints_present": {
          "type": "boolean"
        }
      },
      "anyOf": [
        {
          "properties": {
            "joints_present": {
              "const": true
            }
          }
        },
        {
          "properties": {
            "weights_present": {
              "const": true
            }
          }
        }
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "joints_without_weights_present": {
                "const": true
              }
            }
          },
          "then": {
            "properties": {
              "joints_present": {
                "const": true
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "weights_without_joints_present": {
                "const": true
              }
            }
          },
          "then": {
            "properties": {
              "weights_present": {
                "const": true
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "joints_present": {
                "const": true
              },
              "weights_present": {
                "const": false
              }
            }
          },
          "then": {
            "properties": {
              "joints_without_weights_present": {
                "const": true
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "weights_present": {
                "const": true
              },
              "joints_present": {
                "const": false
              }
            }
          },
          "then": {
            "properties": {
              "weights_without_joints_present": {
                "const": true
              }
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "node_instance": {
      "type": "object",
      "required": [
        "node_index",
        "node_name",
        "mesh_index"
      ],
      "properties": {
        "node_index": {
          "type": "integer",
          "minimum": 0
        },
        "node_name": {
          "type": "string"
        },
        "mesh_index": {
          "type": "integer",
          "minimum": 0
        },
        "static_node_world_aabb": {
          "$ref": "#/$defs/aabb"
        },
        "static_node_world_aabb_unavailable_reason": {
          "enum": [
            "no_finite_positions",
            "skinned_deformation_excluded",
            "non_finite_transform"
          ]
        }
      },
      "oneOf": [
        {
          "required": [
            "static_node_world_aabb"
          ],
          "not": {
            "required": [
              "static_node_world_aabb_unavailable_reason"
            ]
          }
        },
        {
          "required": [
            "static_node_world_aabb_unavailable_reason"
          ],
          "not": {
            "required": [
              "static_node_world_aabb"
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "scene": {
      "type": "object",
      "required": [
        "scene_index",
        "instance_count",
        "excluded_instance_count"
      ],
      "properties": {
        "scene_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "instance_count": {
          "type": "integer",
          "minimum": 0
        },
        "static_scene_world_aabb": {
          "$ref": "#/$defs/aabb"
        },
        "excluded_instance_count": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "material_definition": {
      "type": "object",
      "required": [
        "material_index",
        "texture_bindings"
      ],
      "properties": {
        "material_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "texture_bindings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/material_texture_binding"
          }
        }
      },
      "additionalProperties": false
    },
    "material_texture_binding": {
      "type": "object",
      "required": [
        "slot",
        "texture_index"
      ],
      "properties": {
        "slot": {
          "enum": [
            "base_color",
            "normal",
            "metallic_roughness",
            "occlusion",
            "emissive"
          ]
        },
        "texture_index": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "texture": {
      "type": "object",
      "required": [
        "texture_index",
        "image_index"
      ],
      "properties": {
        "texture_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "image_index": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "image": {
      "type": "object",
      "required": [
        "image_index",
        "source_kind"
      ],
      "properties": {
        "image_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "source_kind": {
          "enum": [
            "embedded",
            "data_uri",
            "external"
          ]
        },
        "declared_mime_type": {
          "type": "string"
        },
        "detected_container": {
          "enum": [
            "png",
            "jpeg"
          ]
        },
        "width": {
          "type": "integer",
          "minimum": 1
        },
        "height": {
          "type": "integer",
          "minimum": 1
        },
        "channel_count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        },
        "decoded_color_type": {
          "enum": [
            "l8",
            "la8",
            "rgb8",
            "rgba8",
            "l16",
            "la16",
            "rgb16",
            "rgba16"
          ]
        },
        "leading_magic_hex": {
          "type": "string",
          "pattern": "^(?:[0-9a-f]{2}){1,16}$"
        },
        "unavailable_reason": {
          "enum": [
            "source_unavailable",
            "invalid_data_uri",
            "unsupported_container",
            "decode_failed",
            "resource_limit"
          ]
        }
      },
      "oneOf": [
        {
          "required": [
            "detected_container",
            "width",
            "height",
            "channel_count",
            "decoded_color_type"
          ],
          "not": {
            "required": [
              "unavailable_reason"
            ]
          }
        },
        {
          "required": [
            "unavailable_reason"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "width"
                ]
              },
              {
                "required": [
                  "height"
                ]
              },
              {
                "required": [
                  "channel_count"
                ]
              },
              {
                "required": [
                  "decoded_color_type"
                ]
              }
            ]
          }
        }
      ],
      "allOf": [
        {
          "if": {
            "required": [
              "leading_magic_hex"
            ]
          },
          "then": {
            "properties": {
              "unavailable_reason": {
                "const": "unsupported_container"
              }
            },
            "required": [
              "unavailable_reason"
            ],
            "not": {
              "required": [
                "detected_container"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "unavailable_reason": {
                "enum": [
                  "source_unavailable",
                  "invalid_data_uri",
                  "decode_failed",
                  "resource_limit"
                ]
              }
            },
            "required": [
              "unavailable_reason"
            ]
          },
          "then": {
            "not": {
              "required": [
                "leading_magic_hex"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "unavailable_reason": {
                "const": "decode_failed"
              }
            },
            "required": [
              "unavailable_reason"
            ]
          },
          "then": {
            "required": [
              "detected_container"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "unavailable_reason": {
                "enum": [
                  "source_unavailable",
                  "invalid_data_uri",
                  "unsupported_container"
                ]
              }
            },
            "required": [
              "unavailable_reason"
            ]
          },
          "then": {
            "not": {
              "required": [
                "detected_container"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "decoded_color_type": {
                "enum": [
                  "l8",
                  "l16"
                ]
              }
            },
            "required": [
              "decoded_color_type"
            ]
          },
          "then": {
            "properties": {
              "channel_count": {
                "const": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "decoded_color_type": {
                "enum": [
                  "la8",
                  "la16"
                ]
              }
            },
            "required": [
              "decoded_color_type"
            ]
          },
          "then": {
            "properties": {
              "channel_count": {
                "const": 2
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "decoded_color_type": {
                "enum": [
                  "rgb8",
                  "rgb16"
                ]
              }
            },
            "required": [
              "decoded_color_type"
            ]
          },
          "then": {
            "properties": {
              "channel_count": {
                "const": 3
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "decoded_color_type": {
                "enum": [
                  "rgba8",
                  "rgba16"
                ]
              }
            },
            "required": [
              "decoded_color_type"
            ]
          },
          "then": {
            "properties": {
              "channel_count": {
                "const": 4
              }
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "skeleton_node": {
      "type": "object",
      "required": [
        "node_index",
        "local_rest",
        "scene_root_indices",
        "rest_world_linear"
      ],
      "properties": {
        "node_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "parent_node_index": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "scene_root_indices": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0
          }
        },
        "local_rest": {
          "$ref": "#/$defs/local_rest"
        },
        "rest_world_matrix": {
          "$ref": "#/$defs/mat4"
        },
        "rest_world_translation_m": {
          "$ref": "#/$defs/vec3"
        },
        "rest_world_linear": {
          "$ref": "#/$defs/linear_transform"
        },
        "rest_world_matrix_unavailable_reason": {
          "enum": [
            "non_finite_local_rest",
            "parent_rest_world_unavailable",
            "non_finite_world_matrix"
          ]
        }
      },
      "oneOf": [
        {
          "required": [
            "rest_world_matrix",
            "rest_world_translation_m"
          ],
          "not": {
            "required": [
              "rest_world_matrix_unavailable_reason"
            ]
          },
          "properties": {
            "rest_world_linear": {
              "$ref": "#/$defs/finite_linear_transform"
            }
          }
        },
        {
          "required": [
            "rest_world_matrix_unavailable_reason"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "rest_world_matrix"
                ]
              },
              {
                "required": [
                  "rest_world_translation_m"
                ]
              }
            ]
          },
          "properties": {
            "rest_world_linear": {
              "allOf": [
                {
                  "$ref": "#/$defs/linear_transform"
                },
                {
                  "properties": {
                    "classification": {
                      "const": "non_finite"
                    }
                  }
                }
              ]
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "local_rest": {
      "type": "object",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "enum": [
            "trs",
            "matrix",
            "unavailable"
          ]
        },
        "translation_parent_space_m": {
          "$ref": "#/$defs/vec3"
        },
        "rotation_xyzw": {
          "$ref": "#/$defs/vec4"
        },
        "scale": {
          "$ref": "#/$defs/vec3"
        },
        "matrix": {
          "$ref": "#/$defs/mat4"
        },
        "reason": {
          "const": "non_finite_transform"
        }
      },
      "oneOf": [
        {
          "properties": {
            "kind": {
              "const": "trs"
            }
          },
          "required": [
            "translation_parent_space_m",
            "rotation_xyzw",
            "scale"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "matrix"
                ]
              },
              {
                "required": [
                  "reason"
                ]
              }
            ]
          }
        },
        {
          "properties": {
            "kind": {
              "const": "matrix"
            }
          },
          "required": [
            "matrix"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "translation_parent_space_m"
                ]
              },
              {
                "required": [
                  "rotation_xyzw"
                ]
              },
              {
                "required": [
                  "scale"
                ]
              },
              {
                "required": [
                  "reason"
                ]
              }
            ]
          }
        },
        {
          "properties": {
            "kind": {
              "const": "unavailable"
            }
          },
          "required": [
            "reason"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "translation_parent_space_m"
                ]
              },
              {
                "required": [
                  "rotation_xyzw"
                ]
              },
              {
                "required": [
                  "scale"
                ]
              },
              {
                "required": [
                  "matrix"
                ]
              }
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "linear_transform": {
      "type": "object",
      "required": [
        "classification"
      ],
      "properties": {
        "classification": {
          "enum": [
            "unit_orthonormal",
            "uniform_scaled",
            "non_uniform",
            "sheared",
            "reflected",
            "singular",
            "non_finite"
          ]
        },
        "axis_lengths": {
          "$ref": "#/$defs/non_negative_vec3"
        },
        "determinant": {
          "type": "number"
        },
        "orientation": {
          "enum": [
            "positive",
            "negative",
            "zero"
          ]
        },
        "uniform_scale": {
          "type": "number",
          "minimum": 0
        },
        "rotation_xyzw": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "minItems": 4,
          "maxItems": 4
        }
      },
      "oneOf": [
        {
          "properties": {
            "classification": {
              "const": "non_finite"
            }
          },
          "not": {
            "anyOf": [
              {
                "required": [
                  "axis_lengths"
                ]
              },
              {
                "required": [
                  "determinant"
                ]
              },
              {
                "required": [
                  "orientation"
                ]
              },
              {
                "required": [
                  "rotation_xyzw"
                ]
              },
              {
                "required": [
                  "uniform_scale"
                ]
              }
            ]
          }
        },
        {
          "properties": {
            "classification": {
              "const": "unit_orthonormal"
            }
          },
          "required": [
            "axis_lengths",
            "determinant",
            "orientation",
            "rotation_xyzw"
          ]
        },
        {
          "properties": {
            "classification": {
              "enum": [
                "uniform_scaled",
                "non_uniform",
                "sheared",
                "reflected",
                "singular"
              ]
            }
          },
          "required": [
            "axis_lengths",
            "determinant",
            "orientation"
          ],
          "not": {
            "required": [
              "rotation_xyzw"
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "finite_linear_transform": {
      "allOf": [
        {
          "$ref": "#/$defs/linear_transform"
        },
        {
          "properties": {
            "classification": {
              "enum": [
                "unit_orthonormal",
                "uniform_scaled",
                "non_uniform",
                "sheared",
                "reflected",
                "singular"
              ]
            }
          }
        }
      ]
    },
    "skin": {
      "type": "object",
      "required": [
        "skin_index",
        "joints",
        "joint_bind_linear_summary",
        "inverse_bind_accessor",
        "attachments"
      ],
      "properties": {
        "skin_index": {
          "type": "integer",
          "minimum": 0
        },
        "name": {
          "type": "string"
        },
        "skeleton_root_node_index": {
          "type": "integer",
          "minimum": 0
        },
        "joints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/skin_joint"
          }
        },
        "joint_bind_linear_summary": {
          "$ref": "#/$defs/skin_bind_linear_summary"
        },
        "inverse_bind_accessor": {
          "$ref": "#/$defs/inverse_bind_accessor"
        },
        "attachments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/skin_attachment"
          }
        }
      },
      "additionalProperties": false
    },
    "skin_bind_linear_summary": {
      "type": "object",
      "required": [
        "classification",
        "joint_count",
        "available_joint_count",
        "unavailable_joint_count"
      ],
      "properties": {
        "classification": {
          "enum": [
            "no_joints",
            "unavailable",
            "partially_unavailable",
            "consistent_uniform",
            "mixed_uniform",
            "non_uniform_or_sheared",
            "reflected_or_singular",
            "mixed"
          ]
        },
        "joint_count": {
          "type": "integer",
          "minimum": 0
        },
        "available_joint_count": {
          "type": "integer",
          "minimum": 0
        },
        "unavailable_joint_count": {
          "type": "integer",
          "minimum": 0
        },
        "consistent_uniform_scale": {
          "type": "number",
          "minimum": 0
        }
      },
      "if": {
        "properties": {
          "classification": {
            "const": "consistent_uniform"
          }
        }
      },
      "then": {
        "required": [
          "consistent_uniform_scale"
        ]
      },
      "else": {
        "not": {
          "required": [
            "consistent_uniform_scale"
          ]
        }
      },
      "additionalProperties": false
    },
    "skin_joint": {
      "type": "object",
      "required": [
        "joint_index",
        "node_index",
        "joint_bind_to_mesh",
        "mesh_bind_world"
      ],
      "properties": {
        "joint_index": {
          "type": "integer",
          "minimum": 0
        },
        "node_index": {
          "type": "integer",
          "minimum": 0
        },
        "joint_bind_to_mesh": {
          "$ref": "#/$defs/joint_bind_to_mesh_matrix"
        },
        "mesh_bind_world": {
          "$ref": "#/$defs/mesh_bind_world_matrix"
        }
      },
      "additionalProperties": false
    },
    "inverse_bind_accessor": {
      "type": "object",
      "required": [
        "status",
        "matrices"
      ],
      "properties": {
        "status": {
          "enum": [
            "absent",
            "available",
            "empty_accessor",
            "count_mismatch",
            "unreadable"
          ]
        },
        "declared_count": {
          "type": "integer",
          "minimum": 0
        },
        "matrices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/mat4"
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "absent"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "properties": {
              "matrices": {
                "maxItems": 0
              }
            },
            "not": {
              "required": [
                "declared_count"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "available"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "declared_count",
              "matrices"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "empty_accessor"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "declared_count"
            ],
            "properties": {
              "declared_count": {
                "const": 0
              },
              "matrices": {
                "maxItems": 0
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "count_mismatch"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "declared_count"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "unreadable"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "declared_count"
            ],
            "properties": {
              "matrices": {
                "maxItems": 0
              }
            }
          }
        }
      ],
      "additionalProperties": false
    },
    "skin_attachment": {
      "type": "object",
      "required": [
        "node_index"
      ],
      "properties": {
        "node_index": {
          "type": "integer",
          "minimum": 0
        },
        "mesh_index": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "derived_bind_matrix": {
      "type": "object",
      "properties": {
        "source_inverse_bind_matrix": {
          "$ref": "#/$defs/mat4"
        },
        "inversion_quality": {
          "$ref": "#/$defs/inversion_quality"
        },
        "matrix": {
          "$ref": "#/$defs/mat4"
        },
        "linear": {
          "$ref": "#/$defs/linear_transform"
        },
        "unavailable_reason": {
          "enum": [
            "inverse_bind_accessor_absent",
            "inverse_bind_accessor_empty",
            "inverse_bind_accessor_count_mismatch",
            "inverse_bind_accessor_unreadable",
            "joint_rest_world_unavailable",
            "inverse_bind_matrix_non_invertible",
            "inverse_bind_matrix_non_affine",
            "inverse_bind_matrix_ill_conditioned",
            "non_finite_derived_matrix"
          ]
        }
      },
      "oneOf": [
        {
          "required": [
            "matrix",
            "linear"
          ],
          "not": {
            "required": [
              "unavailable_reason"
            ]
          },
          "properties": {
            "linear": {
              "$ref": "#/$defs/finite_linear_transform"
            }
          }
        },
        {
          "required": [
            "unavailable_reason"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "matrix"
                ]
              },
              {
                "required": [
                  "linear"
                ]
              }
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "joint_bind_to_mesh_matrix": {
      "allOf": [
        {
          "$ref": "#/$defs/derived_bind_matrix"
        },
        {
          "properties": {
            "unavailable_reason": {
              "enum": [
                "inverse_bind_accessor_absent",
                "inverse_bind_accessor_empty",
                "inverse_bind_accessor_count_mismatch",
                "inverse_bind_accessor_unreadable",
                "inverse_bind_matrix_non_invertible",
                "inverse_bind_matrix_non_affine",
                "inverse_bind_matrix_ill_conditioned",
                "non_finite_derived_matrix"
              ]
            }
          }
        }
      ]
    },
    "mesh_bind_world_matrix": {
      "allOf": [
        {
          "$ref": "#/$defs/derived_bind_matrix"
        },
        {
          "properties": {
            "unavailable_reason": {
              "enum": [
                "inverse_bind_accessor_absent",
                "inverse_bind_accessor_empty",
                "inverse_bind_accessor_count_mismatch",
                "inverse_bind_accessor_unreadable",
                "joint_rest_world_unavailable",
                "non_finite_derived_matrix"
              ]
            }
          }
        }
      ]
    },
    "inversion_quality": {
      "type": "object",
      "required": [
        "reciprocal_condition_number_inf"
      ],
      "properties": {
        "reciprocal_condition_number_inf": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "additionalProperties": false
    },
    "mat4": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "minItems": 16,
      "maxItems": 16
    },
    "aabb": {
      "type": "object",
      "required": [
        "min",
        "max"
      ],
      "properties": {
        "min": {
          "$ref": "#/$defs/vec3"
        },
        "max": {
          "$ref": "#/$defs/vec3"
        }
      },
      "additionalProperties": false
    },
    "non_negative_vec3": {
      "type": "array",
      "items": {
        "type": "number",
        "minimum": 0
      },
      "minItems": 3,
      "maxItems": 3
    },
    "vec3": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "minItems": 3,
      "maxItems": 3
    },
    "vec4": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "minItems": 4,
      "maxItems": 4
    }
  },
  "additionalProperties": false
}
