<?php

use App\Services\Inventory\InventorySelectionHasher;

it('computes the same selection_hash regardless of array ordering', function () {
    $hasher = app(InventorySelectionHasher::class);

    $payloadA = [
        'policy_types' => ['deviceCompliancePolicy', 'deviceConfiguration'],
        'categories' => ['Compliance', 'Configuration'],
        'include_foundations' => true,
        'include_dependencies' => false,
    ];

    $payloadB = [
        'include_dependencies' => false,
        'include_foundations' => true,
        'categories' => ['Configuration', 'Compliance'],
        'policy_types' => ['deviceConfiguration', 'deviceCompliancePolicy'],
    ];

    expect($hasher->hash($payloadA))->toBe($hasher->hash($payloadB));
});
