{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vclaw.dev/schemas/video/artifacts/cinema-scope-report.schema.json",
  "title": "Cinema Scope Report",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "projectSlug", "reportId", "generatedAt", "currentScope", "proposedScope", "metrics", "thresholds", "verdict", "passedChecks", "blockers", "evidenceIds", "contentHash"],
  "properties": {
    "schemaVersion": { "const": 1 },
    "projectSlug": { "$ref": "#/$defs/nonEmpty" },
    "reportId": { "$ref": "#/$defs/nonEmpty" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "currentScope": { "$ref": "#/$defs/scope" },
    "proposedScope": { "oneOf": [{ "$ref": "#/$defs/scope" }, { "type": "null" }] },
    "metrics": { "$ref": "#/$defs/metrics" },
    "thresholds": { "oneOf": [{ "$ref": "#/$defs/thresholds" }, { "type": "null" }] },
    "verdict": { "enum": ["qualified", "blocked", "terminal-scope"] },
    "passedChecks": { "$ref": "#/$defs/stringArray" },
    "blockers": { "$ref": "#/$defs/stringArray" },
    "evidenceIds": { "$ref": "#/$defs/stringArray" },
    "contentHash": { "$ref": "#/$defs/hash" }
  },
  "$defs": {
    "nonEmpty": { "type": "string", "minLength": 1 },
    "hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "scope": { "enum": ["three-shot-proof", "proof-scene", "short-film", "feature"] },
    "stringArray": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/nonEmpty" } },
    "rate": { "type": "number", "minimum": 0, "maximum": 1 },
    "metrics": {
      "type": "object", "additionalProperties": false,
      "required": ["plannedShots", "acceptedShots", "runtimeSeconds", "identityPassRate", "continuityPassRate", "performancePassRate", "editorialPassRate", "recoveryDrillsPassed", "duplicateSpendIncidents", "authorizedCost", "actualCost", "deliveryVerified", "archiveRestoreVerified", "humanApprovalEvidenceIds", "unresolvedBlockers"],
      "properties": {
        "plannedShots": { "type": "integer", "minimum": 0 }, "acceptedShots": { "type": "integer", "minimum": 0 },
        "runtimeSeconds": { "type": "number", "minimum": 0 }, "identityPassRate": { "$ref": "#/$defs/rate" },
        "continuityPassRate": { "$ref": "#/$defs/rate" }, "performancePassRate": { "$ref": "#/$defs/rate" },
        "editorialPassRate": { "$ref": "#/$defs/rate" }, "recoveryDrillsPassed": { "type": "integer", "minimum": 0 },
        "duplicateSpendIncidents": { "type": "integer", "minimum": 0 }, "authorizedCost": { "type": "number", "minimum": 0 },
        "actualCost": { "type": "number", "minimum": 0 }, "deliveryVerified": { "type": "boolean" },
        "archiveRestoreVerified": { "type": "boolean" }, "humanApprovalEvidenceIds": { "$ref": "#/$defs/stringArray" },
        "unresolvedBlockers": { "$ref": "#/$defs/stringArray" }
      }
    },
    "thresholds": {
      "type": "object", "additionalProperties": false,
      "required": ["minimumAcceptedShots", "minimumRuntimeSeconds", "minimumIdentityPassRate", "minimumContinuityPassRate", "minimumPerformancePassRate", "minimumEditorialPassRate", "minimumRecoveryDrills", "requireDelivery", "requireArchiveRestore", "minimumHumanApprovals"],
      "properties": {
        "minimumAcceptedShots": { "type": "integer", "minimum": 0 }, "minimumRuntimeSeconds": { "type": "number", "minimum": 0 },
        "minimumIdentityPassRate": { "$ref": "#/$defs/rate" }, "minimumContinuityPassRate": { "$ref": "#/$defs/rate" },
        "minimumPerformancePassRate": { "$ref": "#/$defs/rate" }, "minimumEditorialPassRate": { "$ref": "#/$defs/rate" },
        "minimumRecoveryDrills": { "type": "integer", "minimum": 0 }, "requireDelivery": { "type": "boolean" },
        "requireArchiveRestore": { "type": "boolean" }, "minimumHumanApprovals": { "type": "integer", "minimum": 0 }
      }
    }
  }
}
