<?php

declare(strict_types=1);

namespace Drupal\flowdrop_runtime\Event;

use Symfony\Contracts\EventDispatcher\Event;

/**
 * Event dispatched when an execution error occurs.
 *
 * @internal
 */
class ExecutionErrorEvent extends Event {

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

  /**
   * Constructs a new ExecutionErrorEvent.
   *
   * @param \Exception $error
   *   The error that occurred.
   * @param string $errorMessage
   *   The error message.
   * @param string $category
   *   The error category.
   * @param string $severity
   *   The error severity.
   * @param array $context
   *   Additional context for the error.
   * @param array $recoveryAction
   *   The recovery action taken.
   * @param int $timestamp
   *   The event timestamp.
   */
  public function __construct(
    public readonly \Exception $error,
    public readonly string $errorMessage,
    public readonly string $category,
    public readonly string $severity,
    public readonly array $context,
    public readonly array $recoveryAction,
    public readonly int $timestamp,
  ) {}

}
