<?php

declare(strict_types=1);

namespace App\Framework\Performance\Events;

use App\Framework\Core\ValueObjects\Timestamp;
use App\Framework\Performance\ValueObjects\PerformanceSnapshot;

/**
 * Event emitted when a performance-tracked operation completes successfully
 */
final readonly class OperationCompletedEvent
{
    public function __construct(
        public PerformanceSnapshot $snapshot,
        public Timestamp $timestamp
    ) {
    }

    /**
     * Get telemetry data for monitoring systems
     */
    public function toTelemetryData(): array
    {
        return array_merge(
            $this->snapshot->toTelemetryData(),
            [
                'event_type' => 'operation_completed',
                'status' => 'success',
            ]
        );
    }
}
