<?php

declare(strict_types=1);

namespace ImovelZapAi\Importing\Domain\Enums;

enum ImportJobStatus: string
{
    case Uploaded = 'uploaded';
    case Analyzing = 'analyzing';
    case PreviewReady = 'preview_ready';
    case AwaitingMapping = 'awaiting_mapping';
    case Ready = 'ready';
    case Queued = 'queued';
    case Processing = 'processing';
    case Completed = 'completed';
    case CompletedWithErrors = 'completed_with_errors';
    case Failed = 'failed';

    public function isTerminal(): bool
    {
        return match ($this) {
            self::Completed, self::CompletedWithErrors, self::Failed => true,
            default => false,
        };
    }

    public function canRetry(): bool
    {
        return match ($this) {
            self::CompletedWithErrors, self::Failed => true,
            default => false,
        };
    }

    public function canConfirm(): bool
    {
        return match ($this) {
            self::PreviewReady, self::Ready => true,
            default => false,
        };
    }
}
