<?php

declare(strict_types=1);

use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;

it('maps provider connection status safely', function (): void {
    $connected = BadgeCatalog::spec(BadgeDomain::ProviderConnectionStatus, 'connected');
    expect($connected->color)->toBe('success');
    expect($connected->label)->toBe('Connected');

    $needsConsent = BadgeCatalog::spec(BadgeDomain::ProviderConnectionStatus, 'needs_consent');
    expect($needsConsent->color)->toBe('warning');
    expect($needsConsent->label)->toBe('Needs consent');

    $error = BadgeCatalog::spec(BadgeDomain::ProviderConnectionStatus, 'error');
    expect($error->color)->toBe('danger');
    expect($error->label)->toBe('Error');

    $disabled = BadgeCatalog::spec(BadgeDomain::ProviderConnectionStatus, 'disabled');
    expect($disabled->color)->toBe('gray');
    expect($disabled->label)->toBe('Disabled');
});

it('maps provider connection health safely', function (): void {
    $ok = BadgeCatalog::spec(BadgeDomain::ProviderConnectionHealth, 'ok');
    expect($ok->color)->toBe('success');
    expect($ok->label)->toBe('OK');

    $degraded = BadgeCatalog::spec(BadgeDomain::ProviderConnectionHealth, 'degraded');
    expect($degraded->color)->toBe('warning');
    expect($degraded->label)->toBe('Degraded');

    $down = BadgeCatalog::spec(BadgeDomain::ProviderConnectionHealth, 'down');
    expect($down->color)->toBe('danger');
    expect($down->label)->toBe('Down');

    $unknown = BadgeCatalog::spec(BadgeDomain::ProviderConnectionHealth, 'unknown');
    expect($unknown->color)->toBe('gray');
    expect($unknown->label)->toBe('Unknown');
});
