<?php

declare(strict_types=1);

namespace App\Framework\Queue\Initializers;

use App\Framework\Database\ConnectionInterface;
use App\Framework\DI\Container;
use App\Framework\DI\Initializer;
use App\Framework\Logging\Logger;
use App\Framework\Queue\Services\WorkerHealthCheckService;
use App\Framework\Queue\Services\WorkerRegistry;

/**
 * Worker Health Check Service Initializer
 */
final readonly class WorkerHealthCheckInitializer
{
    #[Initializer]
    public function __invoke(Container $container): WorkerHealthCheckService
    {
        $workerRegistry = $container->get(WorkerRegistry::class);
        $connection = $container->get(ConnectionInterface::class);
        $logger = $container->get(Logger::class);

        return new WorkerHealthCheckService(
            workerRegistry: $workerRegistry,
            connection: $connection,
            logger: $logger
        );
    }
}
