<?php
require_once __DIR__ . '/admin-server/config/database.php';
$pdo = getDBConnection();

echo "--- ÚLTIMOS 10 EVENTOS RJ ---\n";
$stmt = $pdo->query("SELECT id, event_type, visitor_id, placa, ip_address, created_at FROM events WHERE site_id = 10 AND DATE(created_at) = CURDATE() ORDER BY id DESC LIMIT 10");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    echo "ID: {$row['id']} | Tipo: {$row['event_type']} | Placa: [{$row['placa']}] | Visitor: {$row['visitor_id']} | IP: {$row['ip_address']}\n";
}

echo "\n--- ÚLTIMAS 10 CONSULTAS RJ ---\n";
$stmt = $pdo->query("SELECT id, visitor_id, placa, total_debitos, valor, query_at, updated_at FROM consultas WHERE site_id = 10 AND DATE(updated_at) = CURDATE() ORDER BY updated_at DESC LIMIT 10");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    echo "ID: {$row['id']} | Placa: [{$row['placa']}] | Total: {$row['total_debitos']} | PIX: {$row['valor']} | QAt: {$row['query_at']} | Upd: {$row['updated_at']}\n";
}
