<?php

namespace App\Enums;

enum DocumentStatus: string
{
    case Pending  = 'pending';   // Uploaded — waiting for admin approval
    case Approved = 'approved';  // Visible to members
    case Rejected = 'rejected';  // Admin removed it — not shown

    public function label(): string
    {
        return match($this) {
            DocumentStatus::Pending  => 'Pending Approval',
            DocumentStatus::Approved => 'Approved',
            DocumentStatus::Rejected => 'Rejected',
        };
    }

    public function labelAr(): string
    {
        return match($this) {
            DocumentStatus::Pending  => 'في انتظار الموافقة',
            DocumentStatus::Approved => 'تمت الموافقة',
            DocumentStatus::Rejected => 'مرفوض',
        };
    }

    // Badge color for the admin panel
    public function color(): string
    {
        return match($this) {
            DocumentStatus::Pending  => 'amber',
            DocumentStatus::Approved => 'green',
            DocumentStatus::Rejected => 'red',
        };
    }

    // Is this document visible to members?
    public function isVisible(): bool
    {
        return $this === DocumentStatus::Approved;
    }

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