<?php

declare(strict_types=1);

namespace Drupal\flowdrop_runtime\Event;

use Drupal\flowdrop_runtime\DTO\Runtime\NodeExecutionResult;
use Symfony\Contracts\EventDispatcher\Event;

/**
 * Event dispatched when a node execution completes in NodeRuntimeService.
 *
 * @internal
 */
class NodeCompletedEvent extends Event {

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

  /**
   * Constructs a new NodeCompletedEvent.
   *
   * @param \Drupal\flowdrop_runtime\DTO\Runtime\NodeExecutionResult $result
   *   The node execution result.
   * @param string $executionId
   *   The execution ID.
   * @param string $nodeId
   *   The node ID.
   * @param float $executionTime
   *   The execution time in seconds.
   * @param int $timestamp
   *   The event timestamp.
   */
  public function __construct(
    public readonly NodeExecutionResult $result,
    public readonly string $executionId,
    public readonly string $nodeId,
    public readonly float $executionTime,
    public readonly int $timestamp,
  ) {}

}
