<?php

declare(strict_types=1);

namespace App\Framework\Queue\ValueObjects;

/**
 * Enum representing the status of a job batch
 */
enum JobBatchStatus: string
{
    case PENDING = 'pending';
    case PROCESSING = 'processing';
    case COMPLETED = 'completed';
    case FAILED = 'failed';
    case CANCELLED = 'cancelled';

    public function isFinished(): bool
    {
        return match ($this) {
            self::COMPLETED, self::FAILED, self::CANCELLED => true,
            default => false
        };
    }

    public function isActive(): bool
    {
        return match ($this) {
            self::PENDING, self::PROCESSING => true,
            default => false
        };
    }

    public function getDisplayName(): string
    {
        return match ($this) {
            self::PENDING => 'Pending',
            self::PROCESSING => 'Processing',
            self::COMPLETED => 'Completed',
            self::FAILED => 'Failed',
            self::CANCELLED => 'Cancelled'
        };
    }

    public function getIcon(): string
    {
        return match ($this) {
            self::PENDING => '⏳',
            self::PROCESSING => '🔄',
            self::COMPLETED => '✅',
            self::FAILED => '❌',
            self::CANCELLED => '🚫'
        };
    }
}
