<?php

namespace App\Enums;

use App\Traits\EnumHelper;

enum GenderEnum: string
{
    use EnumHelper;

    case MALE              = 'male';
    case FEMALE            = 'female';
    case OTHER             = 'other';
    case PREFER_NOT_TO_SAY = 'prefer_not_to_say';

    public static function labelFor(self|string|null $gender): ?string
    {
        if (is_string($gender)) {
            $gender = self::tryFrom($gender);
        }

        return $gender?->label();
    }

    public function label(): string
    {
        return __("genders.{$this->value}");
    }
}
