<?php

namespace App\Support\Badges\Domains;

use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeMapper;
use App\Support\Badges\BadgeSpec;

final class PolicyRiskBadge implements BadgeMapper
{
    public function spec(mixed $value): BadgeSpec
    {
        $state = BadgeCatalog::normalizeState($value);

        return match ($state) {
            'low' => new BadgeSpec('Low', 'gray', 'heroicon-m-minus-circle'),
            'low_medium' => new BadgeSpec('Low-medium', 'warning', 'heroicon-m-exclamation-triangle'),
            'medium' => new BadgeSpec('Medium', 'warning', 'heroicon-m-exclamation-triangle'),
            'medium_high' => new BadgeSpec('Medium-high', 'danger', 'heroicon-m-x-circle'),
            'high' => new BadgeSpec('High', 'danger', 'heroicon-m-x-circle'),
            'n/a' => new BadgeSpec('N/A', 'gray', 'heroicon-m-minus-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
