<?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\WorkerRegistry;

/**
 * Worker Registry Initializer
 */
final readonly class WorkerRegistryInitializer
{
    #[Initializer]
    public function __invoke(Container $container): WorkerRegistry
    {
        $connection = $container->get(ConnectionInterface::class);
        $logger = $container->get(Logger::class);

        return new WorkerRegistry(
            connection: $connection,
            logger: $logger
        );
    }
}
