<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Config;

class ThemeServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap services.
     */
    public function boot(): void
    {
        $activeTheme = Config::get('theme.active', 'default');
        $themePath = resource_path("views/themes/{$activeTheme}");

        if (is_dir($themePath)) {
            View::addLocation($themePath);
        }
    }
}
