<?php

namespace App\Framework\Core\Events;

use App\Framework\DI\Container;
use App\Framework\DI\Initializer;
use App\Framework\Discovery\Results\DiscoveryResults;

final readonly class EventDispatcherInitializer
{
    public function __construct(
        private Container        $container,
        private DiscoveryResults $results
    ){}

    #[Initializer]
    public function __invoke(): EventDispatcher
    {
        return new EventDispatcher($this->container, $this->results->get(OnEvent::class));
    }
}
