<?php

declare(strict_types=1);

namespace App\Framework\Redis\ValueObjects;

enum RedisKeyType: int
{
    case STRING = 1;
    case LIST = 3;
    case SET = 2;
    case ZSET = 4;
    case HASH = 5;
    case STREAM = 6;
    case UNKNOWN = 0;

    public static function fromRedisType(int $redisType): self
    {
        return self::tryFrom($redisType) ?? self::UNKNOWN;
    }

    public function getDisplayName(): string
    {
        return match ($this) {
            self::STRING => 'String',
            self::LIST => 'List',
            self::SET => 'Set',
            self::ZSET => 'Sorted Set',
            self::HASH => 'Hash',
            self::STREAM => 'Stream',
            self::UNKNOWN => 'Unknown'
        };
    }

    public function getIcon(): string
    {
        return match ($this) {
            self::STRING => '📝',
            self::LIST => '📋',
            self::SET => '🗂️',
            self::ZSET => '📊',
            self::HASH => '🗃️',
            self::STREAM => '🌊',
            self::UNKNOWN => '❓'
        };
    }
}
