# /opt/docker/dev/service_finder/backend/app/scripts/seed_system_params.py
import asyncio
from sqlalchemy import select
from app.db.session import SessionLocal
from app.models.system import SystemParameter

async def seed_params():
    async with SessionLocal() as db:
        params = [
            {
                "key": "VEHICLE_LIMIT",
                "value": {"free": 1, "premium": 5, "vip": 50},
                "category": "limits",
                "description": "Járműszám korlátok előfizetési csomagonként"
            },
            {
                "key": "xp_multipliers",
                "value": {"manual_input": 1.0, "ocr_scan": 1.5, "verified_hunt": 2.0},
                "category": "gamification"
            }
        ]

        for p in params:
            stmt = select(SystemParameter).where(SystemParameter.key == p["key"])
            if not (await db.execute(stmt)).scalar_one_or_none():
                db.add(SystemParameter(**p))
        
        await db.commit()
        print("✅ Sentinel paraméterek feltöltve.")

if __name__ == "__main__":
    asyncio.run(seed_params())