<?php

namespace App\Enums;

enum CaseStatus: string
{
    case Draft     = 'draft';      // Being written — not visible to members
    case Review    = 'review';     // Ready for Mahmoud to approve
    case Published = 'published';  // Live — visible to all members
    case Archived  = 'archived';   // Retired — kept for reference, not shown

    public function label(): string
    {
        return match($this) {
            CaseStatus::Draft     => 'Draft',
            CaseStatus::Review    => 'Under Review',
            CaseStatus::Published => 'Published',
            CaseStatus::Archived  => 'Archived',
        };
    }

    public function labelAr(): string
    {
        return match($this) {
            CaseStatus::Draft     => 'مسودة',
            CaseStatus::Review    => 'قيد المراجعة',
            CaseStatus::Published => 'منشور',
            CaseStatus::Archived  => 'مؤرشف',
        };
    }

    // Badge color for the admin panel
    public function color(): string
    {
        return match($this) {
            CaseStatus::Draft     => 'gray',
            CaseStatus::Review    => 'amber',
            CaseStatus::Published => 'green',
            CaseStatus::Archived  => 'red',
        };
    }

    // Is this case visible to members?
    public function isVisible(): bool
    {
        return $this === CaseStatus::Published;
    }

    public static function values(): array
    {
        return array_column(self::cases(), 'value');
    }
}
