<?php

namespace App\Insurance\Enum;

/**
 * Service kind an insurance coverage percentage is defined for.
 * Adding a new kind is a single case here: every list (admin settings, contract
 * overrides, service form) is derived from these cases, never hardcoded.
 */
enum ServiceCategory: string
{
    case Outpatient = 'outpatient';
    case Inpatient  = 'inpatient';

    public function label(): string
    {
        return match ($this) {
            self::Outpatient => 'خدمات سرپایی',
            self::Inpatient  => 'خدمات بستری',
        };
    }

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

    public static function tryFromValue(?string $value): ?self
    {
        return $value !== null ? self::tryFrom($value) : null;
    }
}
