<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Auth;

class AppServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->singleton(Auth::class, function ($app) {
            $factory = (new Factory)
                ->withServiceAccount(base_path(env('FIREBASE_CREDENTIALS')))
                ->withProjectId(env('FIREBASE_PROJECT_ID'))
                ->withDatabaseUri(env('FIREBASE_DATABASE_URL'));

            return $factory->createAuth();
        });
    }

    public function boot(): void
    {
        //
    }
} 