<?php
require_once __DIR__ . '/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();

use App\Database;

$pdo = Database::getConnection();

// dislab_records tablosunda veri var mı?
$stmt = $pdo->query('SELECT id, first_name, last_name, referans_id, status FROM dislab_records ORDER BY created_at DESC LIMIT 5');
$records = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo "=== dislab_records ===\n";
if (count($records) === 0) {
    echo "Tablo boş\n";
} else {
    foreach ($records as $record) {
        echo "ID: {$record['id']}, Ad: {$record['first_name']} {$record['last_name']}, Referans: {$record['referans_id']}, Status: {$record['status']}\n";
    }
}

// patients tablosunda veri var mı?
$stmt = $pdo->query('SELECT id, first_name, last_name FROM patients LIMIT 3');
$patients = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "\n=== patients ===\n";
if (count($patients) === 0) {
    echo "Tablo boş\n";
} else {
    foreach ($patients as $p) {
        echo "ID: {$p['id']}, Ad: {$p['first_name']} {$p['last_name']}\n";
    }
}

echo "\nDone\n";
