<?php

declare(strict_types=1);

namespace App\Support;

enum EnvironmentReviewStatus: string
{
    case Draft = 'draft';
    case Ready = 'ready';
    case Published = 'published';
    case Archived = 'archived';
    case Superseded = 'superseded';
    case Failed = 'failed';

    /**
     * @return list<string>
     */
    public static function values(): array
    {
        return array_map(static fn (self $case): string => $case->value, self::cases());
    }

    public function isMutable(): bool
    {
        return in_array($this, [self::Draft, self::Ready, self::Failed], true);
    }

    public function isTerminal(): bool
    {
        return in_array($this, [self::Archived, self::Superseded], true);
    }

    public function isPublished(): bool
    {
        return $this === self::Published;
    }
}
