<?php

declare(strict_types=1);

namespace App\Framework\Core\Performance;

/**
 * Container Performance Result Value Object
 */
final readonly class ContainerPerformanceResult
{
    public function __construct(
        public string $operation,
        public float  $duration,
        public float  $threshold,
        public bool   $isWithinThreshold,
        public string $recommendation
    ) {
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(): array
    {
        return [
            'operation' => $this->operation,
            'duration' => $this->duration,
            'threshold' => $this->threshold,
            'within_threshold' => $this->isWithinThreshold,
            'recommendation' => $this->recommendation,
            'slowness_factor' => $this->duration / $this->threshold,
        ];
    }
}
