1: <?php
2: declare(strict_types=1);
3:
4: namespace om\ICal\Value;
5:
6: /**
7: * STATUS values (RFC 5545, section 3.8.1.11); events, tasks and journal entries allow different ones.
8: */
9: enum Status: string {
10: case Tentative = 'TENTATIVE';
11: case Confirmed = 'CONFIRMED';
12: case Cancelled = 'CANCELLED';
13: case NeedsAction = 'NEEDS-ACTION';
14: case Completed = 'COMPLETED';
15: case InProcess = 'IN-PROCESS';
16: case Draft = 'DRAFT';
17: case Final = 'FINAL';
18:
19: /**
20: * Values allowed in the component.
21: *
22: * @return list<self>
23: */
24: public static function of(string $component): array {
25: return match (strtoupper($component)) {
26: 'VEVENT' => [self::Tentative, self::Confirmed, self::Cancelled],
27: 'VTODO' => [self::NeedsAction, self::Completed, self::InProcess, self::Cancelled],
28: 'VJOURNAL' => [self::Draft, self::Final, self::Cancelled],
29: default => [],
30: };
31: }
32: }
33: