<?php

declare(strict_types=1);

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

it('maps baseline compare matrix state badges through centralized semantics', function (): void {
    expect(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'match')->label)->toBe('Reference aligned')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'differ')->label)->toBe('Drift detected')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'missing')->label)->toBe('Missing from tenant')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'ambiguous')->label)->toBe('Identity ambiguous')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'not_compared')->label)->toBe('Not compared')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixState, 'stale_result')->label)->toBe('Result stale');
});

it('maps baseline compare matrix freshness badges through centralized semantics', function (): void {
    expect(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixFreshness, 'fresh')->label)->toBe('Current result')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixFreshness, 'stale')->label)->toBe('Refresh recommended')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixFreshness, 'never_compared')->label)->toBe('Not compared yet')
        ->and(BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixFreshness, 'unknown')->label)->toBe('Freshness unknown');
});

it('reuses operator trustworthiness semantics for matrix trust badges', function (): void {
    foreach (['trustworthy', 'limited_confidence', 'diagnostic_only', 'unusable'] as $state) {
        $matrixSpec = BadgeCatalog::spec(BadgeDomain::BaselineCompareMatrixTrust, $state);
        $operatorSpec = BadgeCatalog::spec(BadgeDomain::OperatorExplanationTrustworthiness, $state);

        expect($matrixSpec->label)->toBe($operatorSpec->label)
            ->and($matrixSpec->color)->toBe($operatorSpec->color)
            ->and($matrixSpec->icon)->toBe($operatorSpec->icon);
    }
});
