from core.models import Game
from django.utils.text import slugify

games = [
    {"name": "League of Legends", "genre": "moba", "team_size": 5, "has_roles": True, "roles_json": ["Top", "Jungle", "Mid", "ADC", "Support"]},
    {"name": "Valorant", "genre": "fps", "team_size": 5, "has_roles": True, "roles_json": ["Duelist", "Initiator", "Controller", "Sentinel"]},
    {"name": "Counter-Strike 2", "genre": "fps", "team_size": 5, "has_roles": False},
    {"name": "Apex Legends", "genre": "battle_royale", "team_size": 3, "has_roles": True, "roles_json": ["Offensive", "Defensive", "Support", "Recon"]},
    {"name": "Overwatch 2", "genre": "fps", "team_size": 5, "has_roles": True, "roles_json": ["Tank", "Damage", "Support"]},
    {"name": "Dota 2", "genre": "moba", "team_size": 5, "has_roles": True, "roles_json": ["Carry", "Mid", "Offlane", "Soft Support", "Hard Support"]},
    {"name": "Fortnite", "genre": "battle_royale", "team_size": 4, "has_roles": False},
    {"name": "Call of Duty: Warzone", "genre": "battle_royale", "team_size": 4, "has_roles": False},
    {"name": "Rocket League", "genre": "sports", "team_size": 3, "has_roles": False},
    {"name": "Minecraft", "genre": "other", "team_size": None, "has_roles": False},
]

for game_data in games:
    Game.objects.get_or_create(
        name=game_data["name"],
        defaults={
            "slug": slugify(game_data["name"]),
            "genre": game_data["genre"],
            "team_size": game_data.get("team_size"),
            "has_roles": game_data["has_roles"],
            "roles_json": game_data.get("roles_json"),
        }
    )
print(f"Successfully seeded {len(games)} games.")
