<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Dispatcher\Contracts;

use PpPhp\Core\Platform\Event\Queue\DeferredEvent;
use PpPhp\Core\Platform\Event\Dispatcher\DispatcherResult;
use PpPhp\Core\Platform\Event\Dispatcher\DispatcherSnapshot;
use PpPhp\Core\Platform\Event\Dispatcher\DispatcherStatistics;

interface DispatcherInterface
{
    public function dispatch(DeferredEvent $event): DispatcherResult;
    public function dispatchQueued(?callable $handler = null): int;
    public function dispatchScheduled(?callable $handler = null): int;
    public function run(?callable $handler = null): int;
    public function statistics(): DispatcherStatistics;
    public function snapshot(): DispatcherSnapshot;
    public function clear(): void;
}
