<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Worker;

final class WorkerLifecycle
{
    private array $events = [];

    public function record(string $workerId, string $event): void
    {
        $this->events[] = [
            'workerId' => $workerId,
            'event' => $event,
            'recordedAt' => date('c'),
        ];
    }

    public function all(): array
    {
        return $this->events;
    }

    public function count(): int
    {
        return count($this->events);
    }
}
