<?php
declare(strict_types=1);

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

use PpPhp\Core\Platform\Event\Queue\DeferredEvent;
use PpPhp\Core\Platform\Event\Queue\QueueSnapshot;
use PpPhp\Core\Platform\Event\Queue\QueueStatistics;

interface QueueInterface
{
    public function enqueue(DeferredEvent $event): string;
    public function dequeue(): ?DeferredEvent;
    public function peek(): ?DeferredEvent;
    public function cancel(string $id): bool;
    public function clear(): void;
    public function flush(callable $handler): int;
    public function contains(string $id): bool;
    public function size(): int;
    public function isEmpty(): bool;
    public function snapshot(): QueueSnapshot;
    public function restore(QueueSnapshot $snapshot): void;
    public function statistics(): QueueStatistics;
}
