<?php

namespace App\Controllers;

use App\Core\Database;

class ConferencePublicController
{
    public function home()
    {
        $db = Database::getInstance();

        $conferenceId = (int)($_GET['id'] ?? 0);

        if (!$conferenceId) {
            die("Conference not found.");
        }

        $stmt = $db->prepare("
            SELECT *
            FROM conferences
            WHERE id = ?
            LIMIT 1
        ");

        $stmt->execute([$conferenceId]);

        $conference = $stmt->fetch(\PDO::FETCH_ASSOC);

        if (!$conference) {
            die("Conference not found.");
        }

        require BASE_PATH . '/app/views/public/conference_home.php';
    }
}
