<?php

namespace App\Enums;

enum SurveyStatus: string
{
    case Draft  = 'draft';   // Being built — not sent yet
    case Active = 'active';  // Live — accepting responses
    case Closed = 'closed';  // No longer accepting responses

    public function label(): string
    {
        return match($this) {
            SurveyStatus::Draft  => 'Draft',
            SurveyStatus::Active => 'Active',
            SurveyStatus::Closed => 'Closed',
        };
    }

    public function labelAr(): string
    {
        return match($this) {
            SurveyStatus::Draft  => 'مسودة',
            SurveyStatus::Active => 'نشط',
            SurveyStatus::Closed => 'مغلق',
        };
    }

    public function color(): string
    {
        return match($this) {
            SurveyStatus::Draft  => 'gray',
            SurveyStatus::Active => 'green',
            SurveyStatus::Closed => 'red',
        };
    }

    public function isAcceptingResponses(): bool
    {
        return $this === SurveyStatus::Active;
    }

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