"""
Layer 4c: Visual Direction Prompt (v1)

Engine: Opus
Input: Script from 4b + Research report (for infographic data decisions)
Output: Shot-by-shot visual direction brief
"""

METADATA = {
    "version": "v1",
    "layer": "4c",
    "model": "opus",
    "created": "2026-02-12",
    "description": "Generate shot-by-shot visual direction from script"
}

PROMPT = '''You are a visual director for short-form vertical video content. Your job is to create a shot-by-shot creative brief that tells a video producer exactly what the viewer sees at each moment.

## THE SCRIPT
{full_script}

## RESEARCH DATA (for infographic decisions)
{research_report_content}

The research report contains the raw data tables, statistics, and context you need to make decisions about infographic treatments. When the script mentions a statistic, look at the full context in the research to decide:
- Does this stat warrant a full-screen infographic?
- What's the comparison or baseline that makes it meaningful?
- Should it be a simple text overlay or a data visualization?

## YOUR TASK

Break the script into 6-10 shots. Each shot covers roughly 10-15 seconds / 2-3 sentences of spoken content.

### FOR EACH SHOT, SPECIFY:

1. **shot_number**: Sequential number (1, 2, 3...)

2. **segment_text**: The exact script text this shot covers. Copy directly from the script.

3. **duration_seconds**: Approximate duration of this shot (10-15 seconds typical)

4. **visual_type**: One of:
   - "talking_head" - Speaker on camera
   - "b_roll" - Supplementary footage (describe what to search for)
   - "infographic" - Data visualization (requires infographic_specs)
   - "text_overlay" - Text on solid/gradient background
   - "screen_capture" - Screenshot or screen recording
   - "split_screen" - Two visuals side by side (comparison)

5. **on_screen_text**: The exact text displayed on screen during this shot. Pull from [ON SCREEN: "..."] markers in the script, or null if no text overlay.

6. **infographic_specs** (required when visual_type is "infographic"):
   - type: "bar_chart", "comparison", "stat_callout", "timeline", "process_diagram", "counter_animation", "before_after"
   - data: What specific data to visualize
   - key_number: The number that should be largest/most prominent
   - source: Where this data comes from (cite from research)
   - color_guidance: Any color meaning (red for negative, green for positive, etc.)

7. **b_roll_description** (required when visual_type is "b_roll"):
   - What to search for in stock footage
   - Specific enough to find relevant clips

8. **pacing_notes**: One of:
   - "fast_cut" - Quick cuts, energy
   - "hold" - Let the shot breathe, emphasis
   - "slow_zoom" - Gradual zoom for tension/focus
   - "kinetic_text" - Animated text treatment

9. **transition**: How this shot ends/transitions to the next
   - "cut" - Hard cut
   - "dissolve" - Soft transition
   - "wipe" - Directional wipe
   - "zoom_through" - Zoom into next shot

10. **mood_tone**: Brief description of the visual mood
    - Examples: "energetic opening", "clinical/factual", "revelatory moment", "emotional weight", "urgency", "conclusion/resolution"

### SUMMARY BLOCK

After all shots, provide a summary:

- **total_scenes**: Number of distinct shots
- **infographics_needed**: Count of infographic shots
- **stock_footage_needed**: Boolean - does this video need b-roll?
- **stock_footage_descriptions**: Array of what to search for
- **custom_graphics_needed**: Boolean - does this need custom illustrations beyond data viz?
- **talking_head_percentage**: What % of the video is speaker on camera
- **visual_style_note**: One sentence describing the overall visual approach (e.g., "Minimal and data-forward with high-contrast stat callouts", "Documentary-style with emotional b-roll moments")

## OUTPUT FORMAT

Return valid JSON only. No markdown code blocks.

{{
  "visual_direction": {{
    "shots": [
      {{
        "shot_number": 1,
        "segment_text": "Script text this shot covers...",
        "duration_seconds": 12,
        "visual_type": "talking_head",
        "on_screen_text": null,
        "infographic_specs": null,
        "b_roll_description": null,
        "pacing_notes": "fast_cut",
        "transition": "cut",
        "mood_tone": "energetic opening"
      }},
      {{
        "shot_number": 2,
        "segment_text": "Next segment of script...",
        "duration_seconds": 15,
        "visual_type": "infographic",
        "on_screen_text": "62% of workers affected",
        "infographic_specs": {{
          "type": "stat_callout",
          "data": "62% of workers in the industry experienced this",
          "key_number": "62%",
          "source": "Bureau of Labor Statistics 2024",
          "color_guidance": "Red to indicate severity"
        }},
        "b_roll_description": null,
        "pacing_notes": "hold",
        "transition": "dissolve",
        "mood_tone": "revelatory"
      }}
    ],
    "summary": {{
      "total_scenes": 8,
      "infographics_needed": 3,
      "stock_footage_needed": true,
      "stock_footage_descriptions": ["office workers at computers", "news headlines montage"],
      "custom_graphics_needed": false,
      "talking_head_percentage": 50,
      "visual_style_note": "Data-heavy explainer with clean infographics and minimal b-roll"
    }}
  }}
}}
'''
