<?php

declare(strict_types=1);

use App\Support\Inventory\InventoryPolicyTypeMeta;

it('separates canonical inventory type from provider object detail', function (): void {
    $descriptor = InventoryPolicyTypeMeta::typeDescriptorFor('deviceCompliancePolicy', [
        'odata_type' => '#microsoft.graph.deviceCompliancePolicy',
    ]);

    expect($descriptor)->toMatchArray([
        'canonical_type' => 'endpoint_compliance_policy',
        'provider_object_type' => '#microsoft.graph.deviceCompliancePolicy',
        'provider_display_type' => 'Device Compliance',
        'legacy_policy_type' => 'deviceCompliancePolicy',
    ])
        ->and($descriptor['canonical_type'])->not->toBe($descriptor['legacy_policy_type']);
});

it('keeps unknown provider types as provider detail without inventing platform truth', function (): void {
    $descriptor = InventoryPolicyTypeMeta::typeDescriptorFor('futureProviderObject');

    expect($descriptor)->toMatchArray([
        'canonical_type' => 'governed_configuration_artifact',
        'provider_object_type' => 'futureProviderObject',
        'provider_display_type' => 'Future Provider Object',
        'legacy_policy_type' => 'futureProviderObject',
    ]);
});
