{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "vibeedit.evidence.v1"
    },
    "assetId": {
      "type": "string",
      "pattern": "^asset_[a-f0-9]{64}$"
    },
    "revisionId": {
      "type": "string",
      "pattern": "^rev_[a-f0-9]{64}$"
    },
    "sourceSha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "reviewRevision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "durationMicros": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "clock": {
      "type": "object",
      "properties": {
        "timeBase": {
          "type": "object",
          "properties": {
            "numerator": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "denominator": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "numerator",
            "denominator"
          ],
          "additionalProperties": false
        },
        "originPts": {
          "type": "string",
          "pattern": "^-?\\d+$"
        },
        "streamIndex": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "timeBase",
        "originPts"
      ],
      "additionalProperties": false
    },
    "shots": {
      "maxItems": 100000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "shotId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "startMicros": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "endMicrosExclusive": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "startFrame": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "endFrameExclusive": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "parentShotIds": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          "deleted": {
            "default": false,
            "type": "boolean"
          },
          "reviewed": {
            "default": false,
            "type": "boolean"
          },
          "startPts": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "endPtsExclusive": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "shotSetId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "thumbnailUrl": {
            "type": "string",
            "maxLength": 4096
          },
          "origin": {
            "default": "model",
            "type": "string",
            "enum": [
              "model",
              "human",
              "imported"
            ]
          }
        },
        "required": [
          "shotId",
          "startMicros",
          "endMicrosExclusive",
          "deleted",
          "reviewed",
          "origin"
        ],
        "additionalProperties": false
      }
    },
    "words": {
      "maxItems": 200000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "wordId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "startMicros": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "endMicrosExclusive": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "parentWordIds": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          "speakerId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "personId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "reviewed": {
            "default": false,
            "type": "boolean"
          },
          "offscreen": {
            "type": "boolean"
          },
          "reviewLabel": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "music",
                  "background-character"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sectionBreakBefore": {
            "type": "boolean"
          },
          "deleted": {
            "default": false,
            "type": "boolean"
          },
          "line": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "origin": {
            "default": "model",
            "type": "string",
            "enum": [
              "model",
              "human",
              "imported"
            ]
          }
        },
        "required": [
          "wordId",
          "text",
          "startMicros",
          "endMicrosExclusive",
          "speakerId",
          "personId",
          "reviewed",
          "deleted",
          "line",
          "origin"
        ],
        "additionalProperties": false
      }
    },
    "speakers": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "speakerId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "personId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "reviewed": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "speakerId",
          "name",
          "personId",
          "reviewed"
        ],
        "additionalProperties": false
      }
    },
    "people": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "personId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "reviewed": {
            "default": false,
            "type": "boolean"
          },
          "actor": {
            "type": "string",
            "maxLength": 200
          },
          "portraitObservationId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "portraitDataURL": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 32768,
                "pattern": "^data:image\\/(?:jpeg|png|webp);base64,[A-Za-z0-9+/]*={0,2}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "personId",
          "name",
          "reviewed"
        ],
        "additionalProperties": false
      }
    },
    "faces": {
      "maxItems": 500000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "observationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "trackId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "groupId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "startMicros": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "endMicrosExclusive": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "frameOrdinal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "coordinateSpace": {
            "default": "source",
            "type": "string",
            "enum": [
              "source",
              "displayed"
            ]
          },
          "reviewClass": {
            "anyOf": [
              {
                "type": "string",
                "const": "background-character"
              },
              {
                "type": "null"
              }
            ]
          },
          "box": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "y": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "width": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1
              },
              "height": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "x",
              "y",
              "width",
              "height"
            ],
            "additionalProperties": false
          },
          "personId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "rejected": {
            "default": false,
            "type": "boolean"
          },
          "reviewed": {
            "default": false,
            "type": "boolean"
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "origin": {
            "default": "model",
            "type": "string",
            "enum": [
              "model",
              "human",
              "imported"
            ]
          },
          "thumbnailUrl": {
            "type": "string",
            "maxLength": 300000
          }
        },
        "required": [
          "observationId",
          "trackId",
          "startMicros",
          "endMicrosExclusive",
          "coordinateSpace",
          "box",
          "personId",
          "rejected",
          "reviewed",
          "confidence",
          "origin"
        ],
        "additionalProperties": false
      }
    },
    "coverage": {
      "type": "object",
      "properties": {
        "transcript": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "shots": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "faces": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "diarization": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "visualSearch": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "dialogueSearch": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "audioSearch": {
          "default": "unprocessed",
          "type": "string",
          "enum": [
            "unprocessed",
            "waiting",
            "running",
            "partial",
            "ready",
            "silent",
            "failed"
          ]
        },
        "faceMode": {
          "default": "none",
          "type": "string",
          "enum": [
            "none",
            "observed",
            "tracked"
          ]
        },
        "note": {
          "type": "string",
          "maxLength": 4000
        }
      },
      "required": [
        "transcript",
        "shots",
        "faces",
        "diarization",
        "visualSearch",
        "dialogueSearch",
        "audioSearch",
        "faceMode"
      ],
      "additionalProperties": false
    },
    "provenance": {
      "default": [],
      "maxItems": 10000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "producer": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "modelId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "modelRevision": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "artifactSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "configSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "createdAt": {
            "type": "string"
          },
          "coverage": {
            "type": "string",
            "maxLength": 4000
          }
        },
        "required": [
          "stage",
          "producer"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schemaVersion",
    "assetId",
    "revisionId",
    "sourceSha256",
    "reviewRevision",
    "durationMicros",
    "shots",
    "words",
    "speakers",
    "people",
    "faces",
    "coverage",
    "provenance"
  ],
  "additionalProperties": false
}
