<?php

namespace App\Framework\SyntaxHighlighter;

enum TokenType: string {
    case KEYWORD = 'keyword';
    case VARIABLE = 'variable';
    case STRING = 'string';
    case IDENTIFIER = 'identifier';
    case NUMBER = 'number';
    case COMMENT = 'comment';
    case DOC_COMMENT = 'doc-comment';
    case PHP_TAG = 'php-tag';
    case OPERATOR = 'operator';
    case WHITESPACE = 'whitespace';
    case DEFAULT = 'default';

    public function getCssClass(): string {
        return 'token-' . $this->value;
    }

    public function getConsoleColor(): string {
        return match($this) {
            self::KEYWORD => "\033[34m",      // Blau
            self::VARIABLE => "\033[35m",     // Magenta
            self::STRING => "\033[32m",       // Grün
            self::IDENTIFIER => "\033[37m",   // Weiß
            self::NUMBER => "\033[31m",       // Rot
            self::COMMENT => "\033[90m",      // Grau
            self::DOC_COMMENT => "\033[36m",  // Cyan
            self::PHP_TAG => "\033[94m",      // Helles Blau
            self::OPERATOR => "\033[33m",     // Gelb
            default => "\033[0m",             // Reset
        };
    }
}
