<?php

namespace App\Enums;

enum EventStatus: string
{
    case Draft = 'draft';
    case Published = 'published';
    case RegistrationOpen = 'registration_open';
    case RegistrationClosed = 'registration_closed';
    case InProgress = 'in_progress';
    case Completed = 'completed';
    case Cancelled = 'cancelled';
    case Archived = 'archived';

    public function label(): string
    {
        return match ($this) {
            self::Draft => __('enums.event_status.draft'),
            self::Published => __('enums.event_status.published'),
            self::RegistrationOpen => __('enums.event_status.registration_open'),
            self::RegistrationClosed => __('enums.event_status.registration_closed'),
            self::InProgress => __('enums.event_status.in_progress'),
            self::Completed => __('enums.event_status.completed'),
            self::Cancelled => __('enums.event_status.cancelled'),
            self::Archived => __('enums.event_status.archived'),
        };
    }

    public function isPubliclyVisible(): bool
    {
        return ! in_array($this, [self::Draft, self::Archived], true);
    }

    public function allowsRegistration(): bool
    {
        return $this === self::RegistrationOpen;
    }
}
