<?php

namespace App\Enums;

enum FeedColorEnum: string
{
    case SLATE = 'slate';
    case AMBER = 'amber';
    case SKY = 'sky';
    case VIOLET = 'violet';
    case TEAL = 'teal';
    case ROSE = 'rose';
    case INDIGO = 'indigo';
    case ORANGE = 'orange';

    public function dotClass(): string
    {
        return match ($this) {
            self::SLATE => 'bg-slate-500',
            self::AMBER => 'bg-amber-500',
            self::SKY => 'bg-sky-500',
            self::VIOLET => 'bg-violet-500',
            self::TEAL => 'bg-teal-500',
            self::ROSE => 'bg-rose-500',
            self::INDIGO => 'bg-indigo-500',
            self::ORANGE => 'bg-orange-500',
        };
    }

    public static function forId(int $id): self
    {
        $cases = self::cases();

        return $cases[$id % count($cases)];
    }
}
