<?php

namespace App\Providers;

use App\Listeners\SetAgentOfflineOnLogout;
use App\Services\NotificationService;
use App\Services\SendGridEmailService;
use App\Services\PdfService;
use App\Services\PrintQueueService;
use App\Services\WorkboardService;
use Illuminate\Auth\Events\Logout;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider {
    /**
     * Register any application services.
     */
    public function register(): void {
        $this->app->singleton(NotificationService::class);
        $this->app->singleton(PdfService::class);
        $this->app->alias(PdfService::class, 'pdf');
        $this->app->singleton('print-queue', PrintQueueService::class);
        $this->app->singleton(SendGridEmailService::class);
        $this->app->singleton(WorkboardService::class);
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void {
        Blade::anonymousComponentPath(resource_path('views/global'));

        Event::listen(Logout::class, SetAgentOfflineOnLogout::class);
    }
}
