<?php

declare(strict_types=1);

namespace App\Framework\Health\ValueObjects;

/**
 * Enum for response time performance levels
 * Provides standardized performance assessment for health checks
 */
enum ResponseTimeLevel: string
{
    case FAST = 'fast';
    case ACCEPTABLE = 'acceptable';
    case SLOW = 'slow';
    case VERY_SLOW = 'very_slow';

    public function getThresholdMs(): float
    {
        return match ($this) {
            self::FAST => 100.0,
            self::ACCEPTABLE => 500.0,
            self::SLOW => 2000.0,
            self::VERY_SLOW => PHP_FLOAT_MAX
        };
    }

    public function getIcon(): string
    {
        return match ($this) {
            self::FAST => '🚀',
            self::ACCEPTABLE => '✅',
            self::SLOW => '⚠️',
            self::VERY_SLOW => '🐌'
        };
    }

    public function getSeverityScore(): int
    {
        return match ($this) {
            self::FAST => 0,
            self::ACCEPTABLE => 1,
            self::SLOW => 2,
            self::VERY_SLOW => 3
        };
    }

    public function getLabel(): string
    {
        return match ($this) {
            self::FAST => 'Fast',
            self::ACCEPTABLE => 'Acceptable',
            self::SLOW => 'Slow',
            self::VERY_SLOW => 'Very Slow'
        };
    }

    public function isAcceptablePerformance(): bool
    {
        return in_array($this, [self::FAST, self::ACCEPTABLE]);
    }

    public function isPoorPerformance(): bool
    {
        return in_array($this, [self::SLOW, self::VERY_SLOW]);
    }

    public function requiresAttention(): bool
    {
        return $this === self::VERY_SLOW;
    }
}
