Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
ImportJobStatus
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
3 / 3
9
100.00% covered (success)
100.00%
1 / 1
 isTerminal
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
 canRetry
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
 canConfirm
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3declare(strict_types=1);
4
5namespace ImovelZapAi\Importing\Domain\Enums;
6
7enum ImportJobStatus: string
8{
9    case Uploaded = 'uploaded';
10    case Analyzing = 'analyzing';
11    case PreviewReady = 'preview_ready';
12    case AwaitingMapping = 'awaiting_mapping';
13    case Ready = 'ready';
14    case Queued = 'queued';
15    case Processing = 'processing';
16    case Completed = 'completed';
17    case CompletedWithErrors = 'completed_with_errors';
18    case Failed = 'failed';
19
20    public function isTerminal(): bool
21    {
22        return match ($this) {
23            self::Completed, self::CompletedWithErrors, self::Failed => true,
24            default => false,
25        };
26    }
27
28    public function canRetry(): bool
29    {
30        return match ($this) {
31            self::CompletedWithErrors, self::Failed => true,
32            default => false,
33        };
34    }
35
36    public function canConfirm(): bool
37    {
38        return match ($this) {
39            self::PreviewReady, self::Ready => true,
40            default => false,
41        };
42    }
43}