{
  "schema": "globeice.ai_video_analysis_poc.v1",
  "title": "AI video analysis coach POC contract",
  "purpose": "Turn one existing training or match video into coach-reviewable clip candidates with source provenance, pose/keypoint signals, action tags, confidence, and publish gates.",
  "inputs": [
    {
      "field": "video_source_id",
      "type": "string",
      "required": true,
      "description": "Stable source id for the original video."
    },
    {
      "field": "provider",
      "type": "enum",
      "values": ["upload", "youtube", "camera", "club_archive"],
      "required": true,
      "description": "Where the video came from."
    },
    {
      "field": "source_rights",
      "type": "enum",
      "values": ["internal_review", "licensed", "public_link_only", "blocked"],
      "required": true,
      "description": "Publishing boundary before any generated pack leaves private review."
    },
    {
      "field": "manual_reference_clips",
      "type": "array",
      "required": false,
      "description": "Coach-selected clips used to compare AI candidates against the manual baseline."
    }
  ],
  "pipeline": [
    {
      "step": "source_ingest",
      "outputs": ["source_hash", "duration_ms", "provider_id", "origin_tag", "provenance"]
    },
    {
      "step": "scene_detection",
      "outputs": ["shot_id", "t0_ms", "t1_ms", "scene_threshold", "visual_tempo"]
    },
    {
      "step": "pose_estimation",
      "outputs": ["pose_model", "keypoint_track_uri", "keypoint_quality", "occlusion_notes"]
    },
    {
      "step": "action_recognition",
      "outputs": ["event_tags", "confidence_score", "classifier_trace", "asr_key_phrases"]
    },
    {
      "step": "clip_candidate_export",
      "outputs": ["clip_candidates", "diagram_refs", "timestamp_links", "coach_review_status"]
    },
    {
      "step": "coach_review",
      "outputs": ["approved_clips", "edited_labels", "merged_clips", "rejected_candidates", "published_target"]
    }
  ],
  "studio_blueprint": {
    "source_rail": [
      "player_or_session_card",
      "broadcast_channel",
      "wide_angle_channel",
      "bench_or_mobile_upload",
      "source_rights_badge"
    ],
    "video_canvas": [
      "main_video_player",
      "player_detection_boxes",
      "pose_skeleton_overlay",
      "puck_tracking_trail",
      "rink_or_zone_overlay",
      "confidence_badges"
    ],
    "tag_panel": [
      "tactical_tag_template",
      "eventing_buttons",
      "manual_coach_tags",
      "ai_properties",
      "review_status",
      "publish_target"
    ],
    "timeline": [
      "colored_event_ticks",
      "period_markers",
      "searchable_tag_list",
      "active_filter_chips",
      "clip_candidate_queue"
    ],
    "bench_tablet_mode": [
      "approved_clip_playlist",
      "one_tap_feedback",
      "player_safe_view",
      "qr_or_share_handoff",
      "offline_review"
    ]
  },
  "tag_templates": {
    "tactical": ["Breakout", "Regroup", "Forecheck", "Neutral-zone reload", "PP entry", "PK clear"],
    "eventing": ["Shot for", "Shot against", "Goal chance", "Turnover", "Recovery", "Controlled entry"],
    "teaching": ["Good example", "Fix next rep", "Player clip", "Team meeting", "Academy resource", "Do not publish"]
  },
  "review_gates": {
    "green": {
      "condition": "confidence >= 0.75 and rights known and coach approved",
      "action": "Publish notes, diagrams, timestamp links, and review pack."
    },
    "yellow": {
      "condition": "confidence 0.45-0.74 or partial pose/action evidence",
      "action": "Coach edits, merges, splits, or rejects before publishing."
    },
    "red": {
      "condition": "rights unclear, privacy concern, low confidence, or medical/disciplinary inference",
      "action": "Do not publish. Keep private evidence only or discard."
    }
  },
  "minimum_metrics": [
    "time_to_first_useful_clip",
    "candidate_precision_after_coach_review",
    "missed_manual_reference_clips",
    "clips_approved_without_relabeling_percent",
    "rights_status_coverage_percent",
    "average_confidence_by_drill_type"
  ],
  "publish_targets": [
    "org_os_library",
    "session_plan",
    "academy_module",
    "coach_report",
    "media_graph"
  ],
  "coach_clip_docx_contract": {
    "schema_path": "/resources/coach/coach-clip.schema.json",
    "template_path": "/resources/coach/GlobeIce-Coach-Clip-DOCX-Slot-Template.docx",
    "docx_slot_example": "CLIP_A1",
    "human_review_rule": "avg_word_confidence < 0.55 or scene_score < 0.30",
    "auto_publish_rule": "clip_confidence >= 0.62 and duration_s between 6 and 240 seconds when source rights are valid"
  },
  "coach_diagram_contract": {
    "schema_path": "/schemas/coach-diagram.schema.json",
    "canvas": "1000x500 normalized rink",
    "layer_order": ["rink", "players", "puck_path", "arrows", "zone_highlights", "annotations"],
    "svg_master_example": "media/coach-diagrams/vectors/clip1234.play-001.svg",
    "png_fallback_example": "media/coach-diagrams/raster/clip1234.play-001@2x.png",
    "manifest_example": "media/coach-diagrams/manifests/clip1234.play-001.json"
  },
  "non_goals": [
    "Automatic truth publishing",
    "Raw clip redistribution without rights",
    "Medical or disciplinary conclusions from video alone"
  ]
}
