<?php

declare(strict_types=1);

namespace Drupal\flowdrop_runtime\Event;

use Symfony\Contracts\EventDispatcher\Event;

/**
 * Dispatched when a pipeline is paused by an inward Pause signal.
 *
 * The Pause interrupt itself stays pending — it IS the resume key. When
 * resolved (via inbox or `/resume` API), the existing
 * InterruptResolvedSubscriber resumes the pipeline.
 *
 * @internal
 */
class ExecutionPausedEvent extends Event {

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

  /**
   * Constructs a new ExecutionPausedEvent.
   *
   * @param string $executionId
   *   The execution ID of the paused pipeline.
   * @param string $workflowId
   *   The workflow ID.
   * @param string $pipelineId
   *   The pipeline that was paused.
   * @param string $signalId
   *   UUID of the Pause interrupt — this is the resume key.
   * @param string|null $reason
   *   The free-form reason the initiator supplied, if any.
   * @param int|null $initiatorUid
   *   The user who raised the Pause signal, if known.
   */
  public function __construct(
    public readonly string $executionId,
    public readonly string $workflowId,
    public readonly string $pipelineId,
    public readonly string $signalId,
    public readonly ?string $reason,
    public readonly ?int $initiatorUid,
  ) {}

}
