<?php

namespace App\Providers;

use App\Socialite\ChurchToolsProvider;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use Laravel\Socialite\Facades\Socialite;

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

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Vite::prefetch(concurrency: 3);

        Socialite::extend('churchtools', function ($app) {
            $config = $app['config']['services.churchtools'];

            return new ChurchToolsProvider(
                $app['request'],
                $config['client_id'],
                $config['client_secret'],
                $config['redirect'],
            );
        });
    }
}
