<?php

declare(strict_types=1);

namespace App\Framework\DDoS\ValueObjects;

/**
 * DDoS Threat Level Classification
 */
enum ThreatLevel: string
{
    case LOW = 'low';
    case MEDIUM = 'medium';
    case HIGH = 'high';
    case CRITICAL = 'critical';

    public function getNumericValue(): float
    {
        return match ($this) {
            self::LOW => 0.1,
            self::MEDIUM => 0.4,
            self::HIGH => 0.7,
            self::CRITICAL => 0.95
        };
    }

    public function getDescription(): string
    {
        return match ($this) {
            self::LOW => 'Normal traffic pattern, no threat detected',
            self::MEDIUM => 'Suspicious activity detected, enhanced monitoring recommended',
            self::HIGH => 'Potential DDoS attack detected, rate limiting recommended',
            self::CRITICAL => 'Active DDoS attack detected, immediate blocking recommended'
        };
    }

    public function requiresImmediateAction(): bool
    {
        return $this === self::CRITICAL;
    }

    public function requiresEnhancedMonitoring(): bool
    {
        return in_array($this, [self::HIGH, self::CRITICAL]);
    }
}
