# /opt/docker/dev/service_finder/backend/app/test_outside/rontgen_skript.py
import asyncio
import json
from sqlalchemy import text
from app.database import AsyncSessionLocal

async def show_gold():
    async with AsyncSessionLocal() as db:
        res = await db.execute(text('SELECT make, model, power_kw, engine_capacity, fuel_type, factory_data FROM vehicle.vehicle_catalog ORDER BY id DESC LIMIT 10'))
        rows = res.fetchall()
        
        print('\n' + '🏆 AZ ARANY KATALÓGUS LEGÚJABB JÁRMŰVEI 🏆'.center(60))
        print('=' * 60)
        
        for r in rows:
            make, model, kw, ccm, fuel, json_data = r
            print(f'🚗 {make} {model}')
            print(f'   ⚙️  Motor: {ccm or "?"} ccm | {kw or "?"} kW')
            print(f'   ⛽ Üzemanyag: {fuel}')
            
            # Megnézzük, van-e az AI által talált extra adat (pl. motorkód vagy gumi méret)
            if json_data and isinstance(json_data, dict):
                engine_code = json_data.get('engine_code', 'Nincs adat')
                print(f'   🔍 Motorkód (AI/RDW): {engine_code}')
            print('-' * 60)

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

    # docker exec -it sf_api python /app/app/test_outside/rontgen_skript.py