<?php

declare(strict_types=1);

namespace App\Framework\LiveComponents;

use App\Framework\DI\Attributes\Initializer;
use App\Framework\DI\Container;
use App\Framework\Discovery\Results\DiscoveryRegistry;

/**
 * DataProviderResolverInitializer
 *
 * Registers DataProviderResolver in the DI container.
 * The resolver depends on both DiscoveryRegistry and Container.
 */
final readonly class DataProviderResolverInitializer
{
    #[Initializer]
    public function __invoke(Container $container, DiscoveryRegistry $discoveryRegistry): void
    {
        $resolver = new DataProviderResolver($discoveryRegistry, $container);

        $container->singleton(DataProviderResolver::class, $resolver);
    }
}
