#!/usr/bin/env python3
"""Generate final report from the scan data we collected"""
import json

# Data collected from the scan output (all qualifying tweets per account within 3-day cutoff)
accounts = [
    {"handle": "CINEMA505", "qualifying": 20, "total_score": 50827, "best_score": 13802, "best_likes": 0, "best_views": 0, "bio": ""},
    {"handle": "nofilmschool", "qualifying": 18, "total_score": 185, "best_score": 35, "bio": "No Film School -- filmmaking news (~241.7K)"},
    {"handle": "AI_with_jasmin", "qualifying": 12, "total_score": 676, "best_score": 210, "bio": ""},
    {"handle": "venturetwins", "qualifying": 9, "total_score": 17997, "best_score": 7644, "bio": "Justine Moore -- a16z partner AI video (~149.5K)"},
    {"handle": "AIBuzzNews", "qualifying": 9, "total_score": 480, "best_score": 224, "bio": ""},
    {"handle": "azed_ai", "qualifying": 8, "total_score": 926, "best_score": 281, "bio": ""},
    {"handle": "AITECHio", "qualifying": 7, "total_score": 2819, "best_score": 932, "bio": ""},
    {"handle": "c_valenzuelab", "qualifying": 6, "total_score": 303, "best_score": 122, "bio": "Cristobal Valenzuela -- Runway CEO (~42.7K)"},
    {"handle": "higgsfield", "qualifying": 5, "total_score": 11314, "best_score": 6560, "bio": "Higgsfield AI -- multi-model platform (~63K)"},
    {"handle": "CharaspowerAI", "qualifying": 5, "total_score": 397, "best_score": 116, "bio": ""},
    {"handle": "AIWarper", "qualifying": 5, "total_score": 867, "best_score": 412, "bio": ""},
    {"handle": "TheAIColony", "qualifying": 3, "total_score": 711, "best_score": 322, "bio": ""},
    {"handle": "Ai_Vaidehi", "qualifying": 3, "total_score": 307, "best_score": 149, "bio": ""},
    {"handle": "AIFrontliner", "qualifying": 2, "total_score": 539, "best_score": 344, "bio": ""},
    {"handle": "EHuanglu", "qualifying": 2, "total_score": 944, "best_score": 856, "bio": "el.cine / Elsa Huang -- Film director, AI consultant (~128K)"},
    {"handle": "runwayml", "qualifying": 1, "total_score": 554, "best_score": 554, "bio": "Runway AI -- professional AI filmmaking (~260K)"},
    {"handle": "CuriousRefuge", "qualifying": 1, "total_score": 289, "best_score": 289, "bio": "Curious Refuge -- home for AI filmmakers"},
    {"handle": "Kling_ai", "qualifying": 1, "total_score": 514, "best_score": 514, "bio": "Kling AI -- AI video generation (~130K)"},
    {"handle": "higgsfield_ai", "qualifying": 1, "total_score": 356, "best_score": 356, "bio": ""},
    {"handle": "Chandan_Perla", "qualifying": 1, "total_score": 32, "best_score": 32, "bio": ""},
    {"handle": "AITOPIAai", "qualifying": 1, "total_score": 446, "best_score": 446, "bio": ""},
    {"handle": "ChrisLaubAI", "qualifying": 1, "total_score": 29, "best_score": 29, "bio": ""},
    {"handle": "DonutAI", "qualifying": 1, "total_score": 333, "best_score": 333, "bio": ""},
    {"handle": "GoogleAI", "qualifying": 1, "total_score": 880, "best_score": 880, "bio": ""},
    {"handle": "JeffSynthesized", "qualifying": 1, "total_score": 955, "best_score": 955, "bio": ""},
    {"handle": "4aibsc", "qualifying": 2, "total_score": 146, "best_score": 116, "bio": ""},
    {"handle": "pika_labs", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": "Pika -- AI video for social creators (~143K)"},
    {"handle": "paultrillo", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": "Paul Trillo -- LA director/artist (~15K)"},
    {"handle": "CorridorDigital", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": "Corridor Digital -- VFX/filmmaking (15M+ YouTube)"},
    {"handle": "karenxcheng", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "ai_filmmaker", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "visiblemaker", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "Magiermogul", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "WuxiaRocks", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "JiamingSuen", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "moonvalley", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "FaithJaiye2187", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "KammelaBala", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "MyStageAI", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "AI_Video_Dumps", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "GoogleLabs", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "cladlabs", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "AlexStudio44", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
    {"handle": "AIGuideHQ", "qualifying": 0, "total_score": 0, "best_score": 0, "bio": ""},
]

# The top 10 by total_score (need to compute from actual scan data)
# From the scan output, we know the best scores per account.
# Need full tweet details for top 10. Let me output what we know.

# Sort by total_score
sorted_accounts = sorted(accounts, key=lambda a: a["total_score"], reverse=True)

total_with_content = sum(1 for a in accounts if a["qualifying"] > 0)
total_qualifying = sum(a["qualifying"] for a in accounts)
total_scanned = len(accounts)

print("Top accounts by engagement score:")
for i, a in enumerate(sorted_accounts[:15]):
    print(f"  {i+1}. @{a['handle']} -- {a['qualifying']} tweets, total_score={a['total_score']}, best={a['best_score']}")

print(f"\nTotal: {total_scanned} scanned, {total_with_content} with content, {total_qualifying} qualifying tweets")
