<?php

declare(strict_types=1);

it('keeps Microsoft-shaped provider scope out of shared provider platform-core contracts', function (): void {
    $root = base_path();

    $forbiddenByPath = [
        'app/Services/Providers/ProviderIdentityResolution.php' => [
            'tenantContext',
            'target_scope.entra_tenant_id',
        ],
        'app/Services/Providers/ProviderIdentityResolver.php' => [
            'tenantContext',
        ],
        'app/Services/Providers/PlatformProviderIdentityResolver.php' => [
            'tenantContext',
        ],
        'app/Services/Providers/ProviderOperationStartGate.php' => [
            "'entra_tenant_id' =>",
            'target_scope.entra_tenant_id',
        ],
        'config/provider_boundaries.php' => [
            'target_scope.entra_tenant_id',
        ],
    ];

    foreach ($forbiddenByPath as $relativePath => $fragments) {
        $contents = (string) file_get_contents($root.'/'.$relativePath);

        foreach ($fragments as $fragment) {
            expect($contents)
                ->not->toContain($fragment, sprintf('%s still exposes [%s] as shared provider-scope truth.', $relativePath, $fragment));
        }
    }
});
