<?php

namespace App\Enums;

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

enum AnnouncementType: int implements HasColor, HasLabel
{
    use WithComment, WithValue;

    case PUBLIC = 1;
    case COMPANY = 2;

    public function getLabel(): ?string
    {
        return match ($this) {
            self::PUBLIC => 'Publik',
            self::COMPANY => 'Perusahaan',
        };
    }

    public function getColor(): string|array|null
    {
        return match ($this) {
            self::PUBLIC => 'info',
            self::COMPANY => 'warning',
        };
    }

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