<?php

namespace App\Enums;

enum AssetStatusEnum: string
{
    case AVAILABLE = 'available';
    case UNAVAILABLE = 'unavailable';
    case MAINTENANCE = 'maintenance';
    case INACTIVE = 'inactive';

    public function label(): string
    {
        return match ($this) {
            self::AVAILABLE => 'Tersedia',
            self::UNAVAILABLE => 'Tidak Tersedia',
            self::MAINTENANCE => 'Dalam Pemeliharaan',
            self::INACTIVE => 'Tidak Dipublikasikan',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::AVAILABLE => 'success',
            self::UNAVAILABLE => 'danger',
            self::MAINTENANCE => 'warning',
            self::INACTIVE => 'gray',
        };
    }

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