<?php

declare(strict_types=1);

namespace Drupal\native_observability\Event;

use Symfony\Contracts\EventDispatcher\Event;

/**
 * Event fired after a trace has been recorded.
 */
final class TraceRecordedEvent extends Event {

  /**
   * The saved trace record.
   *
   * @var array<string, mixed>
   */
  private array $trace;

  /**
   * Creates a new trace recorded event instance.
   *
   * @param array<string, mixed> $trace
   *   The normalized trace payload that has been persisted.
   */
  public function __construct(array $trace) {
    $this->trace = $trace;
  }

  /**
   * Returns the saved trace data.
   *
   * @return array<string, mixed>
   *   The saved trace record.
   */
  public function getTrace(): array {
    return $this->trace;
  }

}
