<?php
/**
 * Frontend bootstrap: registers public hooks (routing, assets, REST) and delegates to the main plugin class.
 *
 * @package Chess_Podium
 */
if (!defined('ABSPATH')) {
    exit;
}

final class ChessPodium_Frontend
{
    public static function init(): void
    {
        // Public CSS/JS.
        add_action('wp_enqueue_scripts', [ChessPodiumPlugin::class, 'enqueue_widget_styles']);
        add_action('wp_enqueue_scripts', [ChessPodiumPlugin::class, 'enqueue_public_styles']);
        add_action('wp_enqueue_scripts', [ChessPodiumPlugin::class, 'enqueue_tournament_page_assets']);

        // Routing.
        add_action('parse_request', [ChessPodiumPlugin::class, 'parse_game_request'], 1);
        add_action('template_redirect', [ChessPodiumPlugin::class, 'handle_public_route']);
        add_filter('query_vars', [ChessPodiumPlugin::class, 'register_query_vars']);

        // REST endpoints used by live dashboards.
        add_action('rest_api_init', [ChessPodiumPlugin::class, 'register_live_rest_routes']);
    }
}

