<?php

namespace App\Providers;

use App\Events\ServiceEventOccurred;
use App\Listeners\PlatformServiceEventListener;
use App\Services\Meet\Media\LiveKitProvider;
use App\Services\Meet\Media\MediaProviderInterface;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->bind(MediaProviderInterface::class, LiveKitProvider::class);
    }

    public function boot(): void
    {
        Event::listen(ServiceEventOccurred::class, PlatformServiceEventListener::class);

        View::composer(['partials.topbar'], function ($view) {
            $view->with(\App\Support\MobileTopbar::resolve());
        });
    }
}
