<?php

namespace Modules\Dashboard;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Dashboard\Components\DashboardComponent;
use Modules\Invoice\MemberPaymentBlock;
use Modules\Member\AgeGroupCountBlock;
use Modules\Member\TestersBlock;
use Modules\Prevention\EfzPendingBlock;
use Modules\Prevention\PsPendingBlock;

class DashboardServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        app()->singleton(DashboardFactory::class, fn () => new DashboardFactory());
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
            $router->get('/', DashboardComponent::class)->name('home');
        });

        app(DashboardFactory::class)->register(AgeGroupCountBlock::class);
        app(DashboardFactory::class)->register(MemberPaymentBlock::class);
        app(DashboardFactory::class)->register(TestersBlock::class);
        app(DashboardFactory::class)->register(EfzPendingBlock::class);
        app(DashboardFactory::class)->register(PsPendingBlock::class);
    }
}
