<?php

declare(strict_types=1);

namespace App\Domain\QrCode\ValueObject;

enum ErrorCorrectionLevel: string
{
    case L = 'L'; // ~7% Korrektur
    case M = 'M'; // ~15% Korrektur
    case Q = 'Q'; // ~25% Korrektur
    case H = 'H'; // ~30% Korrektur

    public function getCapacityReduction(): float
    {
        return match ($this) {
            self::L => 0.07,
            self::M => 0.15,
            self::Q => 0.25,
            self::H => 0.30,
        };
    }

    public function getNumeric(): int
    {
        return match ($this) {
            self::L => 1,
            self::M => 0,
            self::Q => 3,
            self::H => 2,
        };
    }
}
