<?php

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            'pending' => new BadgeSpec('Pending', 'info', 'heroicon-m-clock'),
            'healthy' => new BadgeSpec('Healthy', 'success', 'heroicon-m-check-circle'),
            'degraded' => new BadgeSpec('Degraded', 'warning', 'heroicon-m-exclamation-triangle'),
            'blocked' => new BadgeSpec('Blocked', 'danger', 'heroicon-m-no-symbol'),
            'error' => new BadgeSpec('Error', 'danger', 'heroicon-m-x-circle'),
            'unknown' => new BadgeSpec('Unknown', 'gray', 'heroicon-m-question-mark-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
