"""
VectorPM Friday video generation — 5 scene cards
Runs the full text → image → video pipeline via VideoGeneratorLoop.run_multi_scene()
"""
import sys
sys.path.insert(0, '/home/aria/projects/marketing-qa-reviewer')

from generator.video_generator_loop import VideoGeneratorLoop

scene_cards = [
    {
        "label": "Scene 1 — Hook: 4:59 PM",
        "framePrompt": "Extreme close-up of a sleek wristwatch face showing 4:59 PM, warm amber light catching the watch crystal, male forearm in white Oxford shirtsleeve resting on wooden desk, shallow depth of field, golden hour light flooding from left, soft bokeh of blurred office window in background",
        "videoPrompt": "WHAT MOVES: second hand on watch face sweeping to 5:00 PM, light shimmer shifts on watch crystal | HOW IT MOVES: second hand sweeps over 2s, warmth of light intensifies slightly as hand reaches 5:00 | WHAT STAYS STILL: forearm, wooden desk surface, office blur",
        "aspectRatio": "9:16",
        "product": "vector",
        "storyBeat": "hook",
    },
    {
        "label": "Scene 2 — The Board is Clear",
        "framePrompt": "Medium shot of young professional man leaning back in a sleek ergonomic office chair, one fist raised in quiet subtle victory, laptop glowing on desk slightly out of focus in foreground, large office window behind him showing warm golden afternoon cityscape, satisfied smile, warm amber light wrapping his shoulders and face",
        "videoPrompt": "WHAT MOVES: man leans back further in chair, right hand rises in relaxed slow fist-pump, smile spreads | HOW IT MOVES: lean-back over 2s smooth and deliberate, fist rises over 1.5s, smile builds naturally | WHAT STAYS STILL: laptop on desk, window cityscape, all desk objects",
        "aspectRatio": "9:16",
        "product": "vector",
        "storyBeat": "problem",
    },
    {
        "label": "Scene 3 — Laptop Shutdown",
        "framePrompt": "Extreme close-up of two hands pressing down to close a sleek dark aluminum laptop lid, fingertips on top edge pushing it shut, warm amber light catching the brushed metal surface from left side, wooden desk below, shallow depth of field, dramatic side rim light",
        "videoPrompt": "WHAT MOVES: laptop lid descends from 90-degree open to fully shut | HOW IT MOVES: lid closes over 2.5s with slow deliberate finality, hands press down gently and firmly, subtle click implied at the end | WHAT STAYS STILL: hands positioned on lid, desk surface, background objects",
        "aspectRatio": "9:16",
        "product": "vector",
        "storyBeat": "solution",
    },
    {
        "label": "Scene 4 — Packing Up",
        "framePrompt": "Medium shot of young professional man standing beside his desk slinging a dark leather shoulder bag over his left shoulder, jacket draped loosely over his right arm, warm amber rim light from window hitting his back and shoulder creating a golden halo, empty ergonomic chair behind him, end-of-day energy, city window in background",
        "videoPrompt": "WHAT MOVES: bag strap swings up and settles over shoulder, man takes first confident step toward camera | HOW IT MOVES: bag sling motion over 1.5s, stride forward over 1s with slight camera hold steady | WHAT STAYS STILL: desk, chair, window light direction",
        "aspectRatio": "9:16",
        "product": "vector",
        "storyBeat": "solution",
    },
    {
        "label": "Scene 5 — Walks Out Free",
        "framePrompt": "Low-angle medium shot of young professional man stepping out through glass office building doors into golden hour sunlight, face tilted slightly upward with eyes closing in relief, warm backlit amber halo silhouetting his outline, phone held loosely at his side, city street stretching behind him, pure Friday freedom energy",
        "videoPrompt": "WHAT MOVES: man steps through door into sunlight, face tilts up slowly, shoulders drop and arms relax outward | HOW IT MOVES: walk-through over 2s, face tilt over 1.5s, arms ease naturally outward, camera stays low-angle static | WHAT STAYS STILL: city background, sunlight direction, glass door frame",
        "aspectRatio": "9:16",
        "product": "vector",
        "storyBeat": "cta",
    },
]

brief = {
    "product": "VectorPM",
    "platform": "tiktok",
    "aspectRatio": "9:16",
    "key_message": "With VectorPM, your board is clear by Friday. Ship your week. Enjoy your weekend.",
    "cta": "vectorpm.io",
    "url": "vectorpm.io",
    "subject": "Professional Filipino male, late 20s, Friday afternoon office",
}

print("Starting VectorPM Friday 5-scene video generation...")
print("Pipeline: text → image → video per scene, stitched")
print()

loop = VideoGeneratorLoop(brandcast_port=3071)
result = loop.run_multi_scene(
    scene_cards=scene_cards,
    brief=brief,
    product="vector",
    platform="tiktok",
    aspect_ratio="9:16",
    use_anchor_frames=True,
    bridge_scenes=False,
    max_anchor_retries=2,
    qa_anchor_frames=True,
)

print()
print("=" * 60)
print(result.summary())
if result.final_video_path:
    print(f"FINAL_VIDEO: {result.final_video_path}")
else:
    print("NO_VIDEO_GENERATED")

for line in result.log[-30:]:
    print(f"  {line}")
