<?php

declare(strict_types=1);

namespace App\Application\LiveComponents\ValueObjects;

/**
 * ChartType - Chart visualization types
 */
enum ChartType: string
{
    case LINE = 'line';
    case BAR = 'bar';
    case PIE = 'pie';
    case AREA = 'area';

    public function getLabel(): string
    {
        return match ($this) {
            self::LINE => 'Liniendiagramm',
            self::BAR => 'Balkendiagramm',
            self::PIE => 'Kreisdiagramm',
            self::AREA => 'Flächendiagramm'
        };
    }

    public function getIcon(): string
    {
        return match ($this) {
            self::LINE => '📈',
            self::BAR => '📊',
            self::PIE => '🥧',
            self::AREA => '📉'
        };
    }

    public static function fromString(string $value): self
    {
        return match ($value) {
            'line' => self::LINE,
            'bar' => self::BAR,
            'pie' => self::PIE,
            'area' => self::AREA,
            default => self::LINE
        };
    }
}
