<?php
declare(strict_types=1);

namespace App\Framework\Console;

/**
 * Enum für Konsolen-Farben mit ANSI-Escape-Codes.
 */
enum ConsoleColor: string
{
    case RESET = "0";

    // Einfache Textfarben
    case BLACK = "30";
    case RED = "31";
    case GREEN = "32";
    case YELLOW = "33";
    case BLUE = "34";
    case MAGENTA = "35";
    case CYAN = "36";
    case WHITE = "37";
    case GRAY = "90";

    // Helle Textfarben
    case BRIGHT_RED = "91";
    case BRIGHT_GREEN = "92";
    case BRIGHT_YELLOW = "93";
    case BRIGHT_BLUE = "94";
    case BRIGHT_MAGENTA = "95";
    case BRIGHT_CYAN = "96";
    case BRIGHT_WHITE = "97";

    // Hintergrundfarben
    case BG_BLACK = "40";
    case BG_RED = "41";
    case BG_GREEN = "42";
    case BG_YELLOW = "43";
    case BG_BLUE = "44";
    case BG_MAGENTA = "45";
    case BG_CYAN = "46";
    case BG_WHITE = "47";

    // Kombinierte Farben
    case WHITE_ON_RED = "97;41";
    case BLACK_ON_YELLOW = "30;43";

    public function toAnsi(): string
    {
        return "\033[{$this->value}m";
    }

}
