<?php

namespace App\Domain\Processing\Enums;

/** §25 ticketing and deployment. */
enum TravelStatus: string
{
    case NotBooked = 'not_booked';
    case Booked = 'booked';
    case Confirmed = 'confirmed';
    case Departed = 'departed';
    case Arrived = 'arrived';
    case Joined = 'joined';
    case Cancelled = 'cancelled';

    public function label(): string
    {
        return match ($this) {
            self::NotBooked => 'Not Booked',
            self::Booked => 'Booked',
            self::Confirmed => 'Confirmed',
            self::Departed => 'Departed',
            self::Arrived => 'Arrived',
            self::Joined => 'Joined Employer',
            self::Cancelled => 'Cancelled',
        };
    }

    /** Deployment is only complete once the worker has actually joined. */
    public function isDeployed(): bool
    {
        return in_array($this, [self::Departed, self::Arrived, self::Joined], true);
    }

    /** @return array<int, string> */
    public static function values(): array
    {
        return array_column(self::cases(), 'value');
    }
}
