<?php

namespace Modules\Admin\App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
use Illuminate\Foundation\AliasLoader;
use Modules\Admin\App\Console\Commands\CleanInitialAvatars;
use Modules\Admin\App\Http\View\Composers\VuexyTemplateComposer;

class VuexyAdminProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        // Register the module's aliases
        AliasLoader::getInstance()->alias('Helper', \Modules\Admin\App\Helpers\Helpers::class);
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // Register any module-specific event listeners here
        if ($this->app->runningInConsole()) {
            $this->commands([
                CleanInitialAvatars::class,
            ]);

            return;
        }

        // Composer para las vistas del módulo Admin
        View::composer('admin::layouts.vuexy.*', VuexyTemplateComposer::class);
    }
}
