<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Dispatcher;

final class DispatcherSnapshot
{
    public function __construct(
        private readonly array $queue,
        private readonly array $scheduler,
        private readonly array $retry,
        private readonly array $statistics,
        private readonly string $createdAt = ''
    ) {}

    public function toArray(): array
    {
        return [
            'queue' => $this->queue,
            'scheduler' => $this->scheduler,
            'retry' => $this->retry,
            'statistics' => $this->statistics,
            'createdAt' => $this->createdAt !== '' ? $this->createdAt : date('c'),
        ];
    }
}
