import aiosqlite
from database.db import DB_PATH
from services.personas import DEFAULT_PERSONAS


async def seed_default_personas():
    async with aiosqlite.connect(DB_PATH) as db:
        for pid, data in DEFAULT_PERSONAS.items():
            await db.execute(
                """INSERT OR IGNORE INTO personas
                   (persona_id, name, emoji, description, prompt, custom, sd_enabled,
                    lora_name, lora_weight, appearance_tags)
                   VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, ?)""",
                (
                    pid,
                    data["name"],
                    data["emoji"],
                    data["description"],
                    data["prompt"],
                    1 if data.get("sd_enabled") else 0,
                    data.get("lora_name", ""),
                    data.get("lora_weight", 0.8),
                    data.get("appearance_tags", ""),
                ),
            )
        await db.commit()
