<?php

namespace App\Support\Badges\Domains;

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

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

        return match ($state) {
            'required' => new BadgeSpec('Required', 'warning', 'heroicon-m-exclamation-triangle'),
            'granted' => new BadgeSpec('Granted', 'success', 'heroicon-m-check-circle'),
            'failed' => new BadgeSpec('Failed', 'danger', 'heroicon-m-x-circle'),
            'revoked' => new BadgeSpec('Revoked', 'danger', 'heroicon-m-no-symbol'),
            'unknown' => new BadgeSpec('Unknown', 'gray', 'heroicon-m-question-mark-circle'),
            default => BadgeSpec::unknown(),
        };
    }
}
