<?php

namespace App\Enums;

enum TransactionStatusEnum: string
{
    case PENDING = 'pending';

    case PAID = 'paid';

    case CANCELLED = 'cancelled';

    case FAILED = 'failed';

    public function label(): string
    {
        return match ($this) {
            self::PENDING => 'Pending',
            self::PAID => 'Paid',
            self::CANCELLED => 'Cancelled',
            self::FAILED => 'Failed',
            default => 'Pending',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::PENDING => 'warning',
            self::PAID => 'success',
            self::CANCELLED => 'danger',
            self::FAILED => 'danger',
            default => 'warning',
        };
    }

    public static function values(): array
    {
        return array_column(self::cases(), 'value');
    }
}
