Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
21 / 21 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ListingStageKey | |
100.00% |
21 / 21 |
|
100.00% |
3 / 3 |
12 | |
100.00% |
1 / 1 |
| label | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
9 | |||
| isTerminal | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| defaultPipelineDefinition | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Owners\Domain\Enums; |
| 6 | |
| 7 | enum ListingStageKey: string |
| 8 | { |
| 9 | case NewContact = 'new_contact'; |
| 10 | case EvaluationScheduled = 'evaluation_scheduled'; |
| 11 | case VisitDone = 'visit_done'; |
| 12 | case Negotiation = 'negotiation'; |
| 13 | case AgreementSigned = 'agreement_signed'; |
| 14 | case Captured = 'captured'; |
| 15 | case Published = 'published'; |
| 16 | case Lost = 'lost'; |
| 17 | |
| 18 | public function label(): string |
| 19 | { |
| 20 | return match ($this) { |
| 21 | self::NewContact => 'Novo Contato', |
| 22 | self::EvaluationScheduled => 'Avaliação Agendada', |
| 23 | self::VisitDone => 'Visita Realizada', |
| 24 | self::Negotiation => 'Negociação', |
| 25 | self::AgreementSigned => 'Contrato Assinado', |
| 26 | self::Captured => 'Captação Concluída', |
| 27 | self::Published => 'Publicação', |
| 28 | self::Lost => 'Perdido', |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | public function isTerminal(): bool |
| 33 | { |
| 34 | return $this === self::Published || $this === self::Lost; |
| 35 | } |
| 36 | |
| 37 | /** @return list<array{key: string, name: string, position: int, is_won: bool, is_lost: bool, color: string}> */ |
| 38 | public static function defaultPipelineDefinition(): array |
| 39 | { |
| 40 | return [ |
| 41 | ['key' => self::NewContact->value, 'name' => self::NewContact->label(), 'position' => 1, 'is_won' => false, 'is_lost' => false, 'color' => '#64748b'], |
| 42 | ['key' => self::EvaluationScheduled->value, 'name' => self::EvaluationScheduled->label(), 'position' => 2, 'is_won' => false, 'is_lost' => false, 'color' => '#0ea5e9'], |
| 43 | ['key' => self::VisitDone->value, 'name' => self::VisitDone->label(), 'position' => 3, 'is_won' => false, 'is_lost' => false, 'color' => '#8b5cf6'], |
| 44 | ['key' => self::Negotiation->value, 'name' => self::Negotiation->label(), 'position' => 4, 'is_won' => false, 'is_lost' => false, 'color' => '#f59e0b'], |
| 45 | ['key' => self::AgreementSigned->value, 'name' => self::AgreementSigned->label(), 'position' => 5, 'is_won' => false, 'is_lost' => false, 'color' => '#14b8a6'], |
| 46 | ['key' => self::Captured->value, 'name' => self::Captured->label(), 'position' => 6, 'is_won' => false, 'is_lost' => false, 'color' => '#10b981'], |
| 47 | ['key' => self::Published->value, 'name' => self::Published->label(), 'position' => 7, 'is_won' => true, 'is_lost' => false, 'color' => '#22c55e'], |
| 48 | ['key' => self::Lost->value, 'name' => self::Lost->label(), 'position' => 8, 'is_won' => false, 'is_lost' => true, 'color' => '#ef4444'], |
| 49 | ]; |
| 50 | } |
| 51 | } |