{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "YouTube Video Content Analysis",
  "description": "Structured analysis of long-form YouTube content with claim verification",
  "type": "object",
  "required": ["meta", "synopsis", "thesis", "claims", "sources", "scores", "rhetoric", "notable_quotes", "verdict"],
  "properties": {
    "meta": {
      "type": "object",
      "required": ["title", "channel", "video_id", "url", "analyzed_by", "analysis_date", "schema_version"],
      "properties": {
        "title": { "type": "string" },
        "channel": { "type": "string" },
        "video_id": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "transcript_file": { "type": "string" },
        "analyzed_by": { "type": "string" },
        "analysis_date": { "type": "string", "format": "date" },
        "schema_version": { "type": "string", "const": "1.0" },
        "upload_date": { "type": ["string", "null"], "format": "date" },
        "view_count": { "type": ["integer", "null"] },
        "duration": { "type": ["string", "null"] },
        "thumbnail": { "type": ["string", "null"] }
      }
    },
    "speakers": {
      "type": "array",
      "description": "Bio blurbs for each speaker/guest in the video",
      "items": {
        "type": "object",
        "required": ["name", "role", "bio"],
        "properties": {
          "name": { "type": "string" },
          "role": { "type": "string", "enum": ["host", "guest", "co-host", "interviewer", "presenter"] },
          "bio": { "type": "string", "description": "2-4 sentence biographical summary with credentials and relevant expertise" },
          "affiliations": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "synopsis": {
      "type": "string",
      "description": "3-5 sentence neutral summary of the video's content"
    },
    "thesis": {
      "type": "object",
      "required": ["central_thesis", "supporting_claims"],
      "properties": {
        "central_thesis": { "type": "string" },
        "supporting_claims": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "claims": {
      "type": "array",
      "description": "Factual claims made in the video, each verified or refuted",
      "items": {
        "type": "object",
        "required": ["claim", "timestamp", "speaker", "category", "verification"],
        "properties": {
          "claim": { "type": "string" },
          "timestamp": { "type": "string", "pattern": "^\\d{2}:\\d{2}:\\d{2}$" },
          "speaker": { "type": "string" },
          "category": {
            "type": "string",
            "enum": ["historical", "scientific", "political", "economic", "statistical", "legal", "other"]
          },
          "verification": {
            "type": "object",
            "required": ["status", "detail"],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["verified", "partially_verified", "disputed", "unverifiable"]
              },
              "detail": { "type": "string", "description": "Evidence assessment" },
              "sources": {
                "type": "array",
                "items": { "type": "string" }
              }
            }
          },
          "screencap": { "type": ["string", "null"] }
        }
      }
    },
    "sources": {
      "type": "object",
      "required": ["named_sources", "vague_appeals"],
      "properties": {
        "named_sources": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["name", "type", "how_used"],
            "properties": {
              "name": { "type": "string" },
              "type": { "type": "string", "enum": ["book", "paper", "primary_document", "scholar", "journalist", "media", "data", "testimony", "other"] },
              "how_used": { "type": "string" },
              "accurate_representation": { "type": ["boolean", "null"] }
            }
          }
        },
        "vague_appeals": {
          "type": "array",
          "items": { "type": "string" }
        },
        "notable_omissions": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "scores": {
      "type": "object",
      "required": ["factual_accuracy", "argumentative_rigor", "framing_and_selectivity", "source_quality", "perspective_diversity", "normative_loading"],
      "properties": {
        "factual_accuracy": { "$ref": "#/$defs/score_entry" },
        "argumentative_rigor": { "$ref": "#/$defs/score_entry" },
        "framing_and_selectivity": { "$ref": "#/$defs/score_entry" },
        "source_quality": { "$ref": "#/$defs/score_entry" },
        "perspective_diversity": { "$ref": "#/$defs/score_entry" },
        "normative_loading": { "$ref": "#/$defs/score_entry" }
      }
    },
    "rhetoric": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["technique", "instance", "timestamp", "effect"],
        "properties": {
          "technique": { "type": "string" },
          "instance": { "type": "string" },
          "timestamp": { "type": "string" },
          "effect": { "type": "string" },
          "screencap": { "type": ["string", "null"] }
        }
      }
    },
    "notable_quotes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["quote", "timestamp", "speaker", "significance"],
        "properties": {
          "quote": { "type": "string" },
          "timestamp": { "type": "string" },
          "speaker": { "type": "string" },
          "significance": { "type": "string" },
          "screencap": { "type": ["string", "null"] }
        }
      }
    },
    "verdict": {
      "type": "object",
      "required": ["strengths", "weaknesses", "viewer_advisory"],
      "properties": {
        "strengths": { "type": "string" },
        "weaknesses": { "type": "string" },
        "viewer_advisory": { "type": "string" }
      }
    }
  },
  "$defs": {
    "score_entry": {
      "type": "object",
      "required": ["score", "justification"],
      "properties": {
        "score": { "type": "integer", "minimum": 1, "maximum": 5 },
        "justification": { "type": "string" }
      }
    }
  }
}
