# -*- coding: utf-8 -*-
from pathlib import Path

SHARED_DEFS = """subject_definitions:
<Picture 1> is the face-and-shoulders anchor for <Subject 1>: a young East Asian woman of about twenty with long wavy dark-red hair falling past her chest, a heavy curled fringe across her brow, cool fair skin, a soft square-round face, bright fox-shaped almond eyes with warm brown irises and slightly lifted outer corners, light natural make-up, a small silver pendant necklace and the collar of a beige trench coat.
<Picture 2> is the full-body and costume anchor for <Subject 1>: an oversized beige trench coat worn open over a cropped white crew-neck tee, a black pleated mini skirt, matte black semi-sheer tights, chunky white Crocs clogs with a few coloured charms, her hands empty.
<Picture 3> is the environment, <Subject 2>: an empty autumn riverside promenade in the late afternoon - a metal railing running only along the left edge of a curved paved walkway, a low planting strip and road verge on the right, a river of scattered gold glints beyond the railing, a low bridge and turning trees melting into soft bokeh, dry leaves and dust motes in the air, low warm backlight.
<Subject 1> is the young woman defined by <Picture 1> and <Picture 2>.
<Subject 2> is the riverside promenade defined by <Picture 3>."""

STYLE = ("Japanese CG animation feature film with semi-realistic 3D character rendering - a modern anime film's CG compositing: "
         "3D-rendered characters with anime design proportions, soft matte skin with subtle subsurface scattering, hair built from "
         "sculpted clumps plus fine flyaway strands, physically lit shading, realistic shallow depth of field, volumetric haze and "
         "rendering-engine bloom; 16:9, 24 fps, 35mm lens with a handheld breathing sway; low-saturation teal-blue shadow against "
         "warm gold highlight, soft low contrast, fine film grain, translucent airy atmosphere. No coloured lens flare and no green "
         "or teal ghosting may cross her face, hair or coat at any time; any flare stays small and in the far background sky.")

RETENTION = """retention_analysis:
<Subject 1> (appears in [Shot 1]): identity_fully_preserved - the same face, the same dark-red wavy hair with the curled fringe, the same beige trench, white cropped tee, black pleated skirt, black tights and white clogs.
<Picture 1> (appears in [Shot 1]): fully_referenced - her face, eyes, brows, nose, mouth, skin tone, hair colour and fringe stay identical, warm brown irises with no colour cast on the eyes.
<Picture 2> (appears in [Shot 1]): fully_referenced - the trench coat, cropped tee, pleated mini skirt, black tights, white clogs and her body proportions stay identical.
<Subject 2> (appears in [Shot 1]): fully_preserved - the railing only on the left, the curved walkway, the river, the low bridge, the turning trees, the warm backlight and the drifting leaves stay consistent.
<Picture 3> (appears in [Shot 1]): fully_preserved - rebuilt as one continuous three-dimensional space with correct perspective and parallax, never pasted as a flat backdrop, and no extra person, bench, car or building is added."""

SOUND = """overall_soundscape:
A calm riverside afternoon: water running over stones, a light wind through the turning trees, dry leaves rustling and one or two ticking onto the paving, her soft footsteps and the light scuff of clogs on the walkway, the faint rustle of her trench coat and pleated skirt, and the distant low hum of the city.

non_diegetic_music:
A sparse, warm piano melody in a slow 6/8 at about 66 BPM over a soft sustained string pad with a very quiet sub bass; instrumental, no vocals."""

SHOTS = [
    dict(id="s1", frames=141, summary="[reference generation] A 5.9-second 16:9 fragment of a Japanese CG animated film: <Subject 1> walks slowly away along the riverside promenade of <Subject 2> in the low autumn sun, the camera tracking from behind her right side.",
         body="""[Shot 1] 0.00s-5.88s. """+STYLE+""" Medium-full shot, the camera at chest height tracking from behind her right side as <Subject 1> walks slowly away along the walkway of <Subject 2>, staying in the right third of the frame with the railing and the river opening on the left. She is already mid-stride at 0.00 seconds; the trench coat hem, the skirt pleats and her long wavy hair trail and swing with each step, her arms swing lightly and she lowers her gaze to the path now and then. Low golden afternoon backlight rims her crown, her shoulder and the coat edge; the river throws up glints of gold, the trees and low bridge behind her dissolve into soft bokeh, and dry leaves drift past the lens. Slow continuous walking with natural cloth and hair inertia; no cut inside this shot."""),
    dict(id="s2", frames=141, summary="[reference generation] A 5.9-second 16:9 fragment of a Japanese CG animated film: the camera pushes in closer behind <Subject 1>'s right shoulder as she keeps walking the riverside promenade, wind throwing strands of hair across her cheek.",
         body="""[Shot 1] 0.00s-5.88s. """+STYLE+""" Closer medium shot on the same walkway, still tracking from behind her right side and gently pushing in, <Subject 1> keeps walking at the same unhurried pace. The wind lifts strands of her dark-red hair across her pale cheek and her clear, slightly melancholic eyes; the collar of the trench and the skirt hem sway with inertia; her gaze stays ahead and slightly down. Soft golden rim light on her hair and shoulder, warm bokeh of the river and railing behind, a few leaves crossing the frame. The push-in is slow and steady; no cut inside this shot."""),
    dict(id="s3", frames=192, summary="[reference generation] An 8-second 16:9 fragment of a Japanese CG animated film: a side close-up in which <Subject 1> tucks her wind-blown hair behind her ear and turns her profile toward the river.",
         body="""[Shot 1] 0.00s-8.00s. """+STYLE+""" Side close-up of <Subject 1> at the railing of <Subject 2>: she slows, raises her right hand and tucks the wind-blown hair behind her ear, her fingers sliding along her cheek and the shell of her ear, then her head turns to a three-quarter side view toward the river and she watches the water. A few loose strands fall back across her temple. Shallow focus holds on her eye and lashes - warm brown irises as in <Picture 1> - while the railing and the glittering river behind her collapse into soft gold bokeh; a warm sunset catchlight sits in her eye; her expression stays quiet with the beginning of a faint smile. Handheld micro sway, slow deliberate motion; no cut inside this shot."""),
    dict(id="s4", frames=175, summary="[reference generation] A 7.3-second 16:9 fragment of a Japanese CG animated film: a frontal medium shot in which <Subject 1> nearly stops, lifts her eyes to the lens and smiles, then lowers her gaze.",
         body="""[Shot 1] 0.00s-7.29s. """+STYLE+""" Frontal medium shot, slight low angle, <Subject 1> nearly stops on the walkway of <Subject 2>; the low sun backlights her so her hair, shoulders and the edge of the trench coat carry a warm golden rim while her face is softly filled by light bouncing off the pavement. She lifts her eyes to the camera and gives a gentle small smile, then lowers her gaze slightly and her lips settle. Floating dust turns in the sunbeams behind her, the trees dissolve into warm bokeh and a tiny soft flare stays high in the sky, never crossing her face. Very slow, quiet motion; no cut inside this shot."""),
    dict(id="s5", frames=158, summary="[reference generation] A 6.6-second 16:9 fragment of a Japanese CG animated film: <Subject 1> resumes walking and the camera tracks again from behind her side, back and profile alternating.",
         body="""[Shot 1] 0.00s-6.58s. """+STYLE+""" Medium shot tracking again from behind her side as <Subject 1> resumes walking slowly along <Subject 2>; the framing drifts between her back and a glimpse of her profile as she turns her head a little. The distant bridge and the turning trees melt into soft colour blobs, leaves cross the frame, warm rim light runs along her hair and the trench, cool blue shadow lies on the walkway. Calm, nostalgic autumn feeling, natural cloth and hair inertia; no cut inside this shot."""),
    dict(id="s6", frames=124, summary="[reference generation] A 5.2-second 16:9 fragment of a Japanese CG animated film: a wide shot that slowly pulls back as <Subject 1> walks away into the depth of the riverside promenade.",
         body="""[Shot 1] 0.00s-5.17s. """+STYLE+""" Wide shot that slowly pulls back or gently rises: <Subject 1> walks away into the depth of the walkway of <Subject 2>, her figure becoming smaller, the riverbank lines leading toward the horizon, foreground leaves drifting across the lower frame. Strong golden backlight makes a soft silhouette of her hair and coat, the plaza and bridge fall into warm haze, and the image settles toward a soft fade-out while she keeps walking; no cut inside this shot."""),
]

for s in SHOTS:
    txt = "\n\n".join([SHARED_DEFS, "summary:\n" + s["summary"], RETENTION,
                       "detailed_description:\n" + s["body"], SOUND])
    Path(f"prompt_{s['id']}.txt").write_text(txt + "\n", encoding="utf-8")
print("wrote", len(SHOTS))
