<?php

declare(strict_types=1);

namespace FleekDash\Frontend;

use FleekDash\Frontend\Assets as FrontendAssets;
use FleekDash\Frontend\FleekPages as FrontendFleekPages;
use FleekDash\Frontend\Login as FrontendLogin;
use FleekDash\Frontend\VoxelAssets as FrontendVoxelAssets;
use FleekDash\Traits\Base;

/**
 * Class Frontend
 *
 * Main class that coordinates all frontend functionality.
 *
 * @package FleekDash\Frontend
 */
class Frontend
{
    use Base;

    private ?FrontendAssets $assets = null;

    private ?FrontendLogin $login = null;

    private ?FrontendVoxelAssets $voxelAssets = null;

    private ?FrontendFleekPages $fleekPages = null;

    /**
     * Frontend bootstrapper.
     *
     * @return void
     */
    public function bootstrap(): void
    {
        // Initialize components
        $this->assets = new FrontendAssets();
        $this->fleekPages = new FrontendFleekPages();
        $this->login = new FrontendLogin();
        $this->voxelAssets = new FrontendVoxelAssets();

        // Bootstrap each component
        $this->assets->bootstrap(); // Handles admin bar styles and frontend assets
        $this->fleekPages->bootstrap(); // Must be before login to handle ?fleekpage=login
        $this->login->bootstrap();
        $this->voxelAssets->bootstrap();
    }
}
