<?php

namespace App\Enums;

use App\Traits\Enum\WithComment;
use App\Traits\Enum\WithValue;
use Filament\Support\Contracts\HasLabel;

enum Channel: int implements HasLabel
{
    use WithComment, WithValue;

    case WEBSITE = 1;
    case TIKTOK = 2;
    case YOUTUBE = 3;
    case FACEBOOK = 4;
    case INSTAGRAM = 5;
    case TWITTER = 6;
    case OTHER = 7;

    public function getLabel(): ?string
    {
        return match ($this) {
            self::WEBSITE => 'Website',
            self::TIKTOK => 'Tiktok',
            self::YOUTUBE => 'Youtube',
            self::FACEBOOK => 'Facebook',
            self::INSTAGRAM => 'Instagram',
            self::TWITTER => 'Twitter',
            self::OTHER => 'Other',
        };
    }

    public function getColor(): string
    {
        return match ($this) {
            self::WEBSITE => 'info',
            self::TIKTOK => 'success',
            self::YOUTUBE => 'warning',
            self::FACEBOOK => 'danger',
            self::INSTAGRAM => 'primary',
            self::TWITTER => 'secondary',
            self::OTHER => 'gray',
        };
    }

    public static function options(): array
    {
        return collect(self::cases())
            ->mapWithKeys(fn ($case) => [$case->value => $case->getLabel()])
            ->toArray();
    }
}
