<?php

declare(strict_types=1);

namespace App\Framework\Console\Health;

use App\Framework\Console\Health\Checks\AnalyticsHealthCheck;
use App\Framework\Console\Health\Checks\CommandRegistryHealthCheck;
use App\Framework\Console\Health\Checks\PerformanceHealthCheck;
use App\Framework\DI\Attributes\Initializer;
use App\Framework\DI\Container;

final readonly class HealthInitializer
{
    #[Initializer]
    public function initialize(Container $container): void
    {
        // Register individual health checks
        $container->singleton(CommandRegistryHealthCheck::class);
        $container->singleton(AnalyticsHealthCheck::class);
        $container->singleton(PerformanceHealthCheck::class);

        // Register health service with all checks
        $container->singleton(HealthService::class, function (Container $container) {
            return new HealthService([
                $container->get(CommandRegistryHealthCheck::class),
                $container->get(PerformanceHealthCheck::class),
                $container->get(AnalyticsHealthCheck::class),
            ]);
        });
    }
}
