<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Retry;

use Throwable;
use PpPhp\Core\Platform\Event\Queue\DeferredEvent;

final class RetryContext
{
    public function __construct(
        private readonly DeferredEvent $event,
        private readonly int $attempt,
        private readonly int $maxAttempts,
        private readonly ?Throwable $exception = null,
        private readonly array $metadata = []
    ) {}

    public function event(): DeferredEvent { return $this->event; }
    public function attempt(): int { return $this->attempt; }
    public function maxAttempts(): int { return $this->maxAttempts; }
    public function exception(): ?Throwable { return $this->exception; }
    public function metadata(): array { return $this->metadata; }
}
