<?php

declare(strict_types=1);

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

it('maps policy snapshot mode values to canonical badge semantics', function (): void {
    $full = BadgeCatalog::spec(BadgeDomain::PolicySnapshotMode, 'full');
    expect($full->label)->toBe('Full');
    expect($full->color)->toBe('success');

    $metadataOnly = BadgeCatalog::spec(BadgeDomain::PolicySnapshotMode, 'metadata_only');
    expect($metadataOnly->label)->toBe('Metadata only');
    expect($metadataOnly->color)->toBe('warning');
});

it('maps policy restore mode values to canonical badge semantics', function (): void {
    $enabled = BadgeCatalog::spec(BadgeDomain::PolicyRestoreMode, 'enabled');
    expect($enabled->label)->toBe('Enabled');
    expect($enabled->color)->toBe('success');

    $previewOnly = BadgeCatalog::spec(BadgeDomain::PolicyRestoreMode, 'preview-only');
    expect($previewOnly->label)->toBe('Preview only');
    expect($previewOnly->color)->toBe('warning');
});

it('maps policy risk values to canonical badge semantics', function (): void {
    $low = BadgeCatalog::spec(BadgeDomain::PolicyRisk, 'low');
    expect($low->label)->toBe('Low');
    expect($low->color)->toBe('gray');

    $mediumHigh = BadgeCatalog::spec(BadgeDomain::PolicyRisk, 'medium-high');
    expect($mediumHigh->label)->toBe('Medium-high');
    expect($mediumHigh->color)->toBe('danger');
});

it('maps ignored-at presence to canonical badge semantics', function (): void {
    $notIgnored = BadgeCatalog::spec(BadgeDomain::IgnoredAt, null);
    expect($notIgnored->label)->toBe('No');
    expect($notIgnored->color)->toBe('gray');

    $ignored = BadgeCatalog::spec(BadgeDomain::IgnoredAt, '2026-01-01T00:00:00Z');
    expect($ignored->label)->toBe('Yes');
    expect($ignored->color)->toBe('warning');
});

it('maps RBAC foundation restore modes to preview-only metadata', function (): void {
    expect(InventoryPolicyTypeMeta::restoreMode('intuneRoleDefinition'))->toBe('preview-only');
    expect(InventoryPolicyTypeMeta::restoreMode('intuneRoleAssignment'))->toBe('preview-only');
});
