<?php

declare(strict_types=1);

namespace Drupal\flowdrop_runtime\Event;

use Drupal\flowdrop_runtime\DTO\RealTime\RealTimeEvent as RealTimeEventDTO;
use Symfony\Contracts\EventDispatcher\Event;

/**
 * Event dispatched when a real-time event is broadcast.
 *
 * @internal
 */
class RealTimeBroadcastEvent extends Event {

  /**
   * The event name.
   */
  const NAME = 'flowdrop_runtime.real_time_event';

  /**
   * Constructs a new RealTimeBroadcastEvent.
   *
   * @param \Drupal\flowdrop_runtime\DTO\RealTime\RealTimeEvent $realTimeEvent
   *   The real-time event DTO.
   * @param string $type
   *   The event type.
   * @param string $executionId
   *   The execution ID.
   * @param string $event
   *   The event name within the type.
   * @param array $data
   *   The event data.
   * @param int $timestamp
   *   The event timestamp.
   * @param string|null $nodeId
   *   The node ID, if applicable.
   */
  public function __construct(
    public readonly RealTimeEventDTO $realTimeEvent,
    public readonly string $type,
    public readonly string $executionId,
    public readonly string $event,
    public readonly array $data,
    public readonly int $timestamp,
    public readonly ?string $nodeId = NULL,
  ) {}

}
