<?php

namespace App\Domain\Workflow\Enums;

/** §20 appointment lifecycle, including attendance. */
enum AppointmentStatus: string
{
    case Scheduled = 'scheduled';
    case Confirmed = 'confirmed';
    case Attended = 'attended';
    case NoShow = 'no_show';
    case Rescheduled = 'rescheduled';
    case Cancelled = 'cancelled';

    public function label(): string
    {
        return match ($this) {
            self::Scheduled => 'Scheduled',
            self::Confirmed => 'Confirmed',
            self::Attended => 'Attended',
            self::NoShow => 'No Show',
            self::Rescheduled => 'Rescheduled',
            self::Cancelled => 'Cancelled',
        };
    }

    /** Still going to happen. */
    public function isUpcoming(): bool
    {
        return in_array($this, [self::Scheduled, self::Confirmed], true);
    }

    public function isClosed(): bool
    {
        return ! $this->isUpcoming();
    }

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