<?php
define('ROOT_PATH', dirname(__DIR__));
require_once ROOT_PATH . '/app/core/Autoloader.php';
\App\Core\Autoloader::register();

// Run bootstrap
$bootstrap = new \App\Core\Bootstrap();
$bootstrap->init();

use App\Core\Database;

try {
    $db = Database::getConnection();
    $stmt = $db->query("SELECT u.id, u.email, u.username, u.display_name, r.name AS role_name FROM users u JOIN roles r ON r.id = u.role_id");
    $users = $stmt->fetchAll();
    echo "USERS IN DATABASE:\n";
    print_r($users);
    
    $stmt2 = $db->query("SELECT id, slug FROM workspaces");
    $workspaces = $stmt2->fetchAll();
    echo "\nWORKSPACES IN DATABASE:\n";
    print_r($workspaces);
} catch (\Throwable $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}
