<?php

namespace App\Providers;

use App\Models\PensionCase\PensionCase;
use App\Models\WillsCase\WillsCase;
use App\Policies\PensionCasePolicy;
use App\Policies\WillsCasePolicy;
use App\Services\SendGridEmailService;
use App\Services\PdfService;
use App\Services\PrintQueueService;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

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

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

        Gate::policy(PensionCase::class, PensionCasePolicy::class);
        Gate::policy(WillsCase::class, WillsCasePolicy::class);
    }
}
