def get_video_script_prompt(synthesis: dict, language: str = "ar",
                            duration_seconds: int = None, user_notes: str = None) -> list:
    lang_instruction = "Respond entirely in Arabic." if language == "ar" else "Respond entirely in English."
    
    project_name = synthesis.get("project_description", "")[:200]
    exec_summary = synthesis.get("executive_summary", "")[:500]
    value_prop = ""
    bmc = synthesis.get("business_model_canvas", {})
    if isinstance(bmc, dict):
        vp = bmc.get("value_propositions", [])
        value_prop = ", ".join(str(v) for v in vp[:3]) if isinstance(vp, list) else str(vp)
    
    target = ""
    ta = synthesis.get("target_audience", [])
    if isinstance(ta, list) and ta:
        target = ", ".join(p.get("persona_name", "") for p in ta[:3] if isinstance(p, dict))

    # Duration instruction
    dur = duration_seconds or 30
    dur_instruction = f"The video MUST be exactly {dur} seconds long. Distribute scenes to fill exactly {dur} seconds total."

    # User notes instruction
    notes_instruction = ""
    if user_notes:
        notes_instruction = (
            f"\n\nIMPORTANT — The user has provided these specific instructions for the script. "
            f"You MUST incorporate them:\n\"{user_notes}\"\n"
        )

    return [
        {
            "role": "system",
            "content": (
                "You are a professional video script writer for marketing videos. "
                f"Create a promotional video script based on a business feasibility report. "
                f"{dur_instruction} "
                f"{lang_instruction}\n\n"
                "Return your response as valid JSON with these keys:\n"
                f"title: string (video title),\n"
                f"duration_seconds: number (must be {dur}),\n"
                "scenes: [{scene_number: number, duration: string (e.g. '5s'), visual_description: string, "
                "narration: string, on_screen_text: string}],\n"
                "voiceover_full_script: string (complete narration text),\n"
                "music_mood: string,\n"
                "target_platforms: [string],\n"
                "hashtags: [string]"
            ),
        },
        {
            "role": "user",
            "content": (
                f"Create a promotional video script for this business:\n\n"
                f"Description: {project_name}\n"
                f"Summary: {exec_summary}\n"
                f"Value Proposition: {value_prop}\n"
                f"Target Audience: {target}\n\n"
                f"Video duration: {dur} seconds.\n"
                "Make it engaging, professional, and suitable for social media platforms."
                f"{notes_instruction}"
            ),
        },
    ]
