<?php

namespace Tests\Feature\Api\V1\FullSurface;

use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;

class ApiBatch16AccessibilityAndClientHintsContractTest extends FullSurfaceE2EContractCase
{
    public function test_batch16_client_hints_accessibility_headers_and_locale_variants_do_not_change_authorization(): void
    {
        $routes = $this->apiRoutesContainingAny(['students', 'parents', 'teacher', 'dashboard', 'reports', 'profile', 'settings']);

        foreach (array_slice($routes, 0, 50) as $route) {
            $method = $this->primaryMethod($route);
            $uri = $route->uri();
            $response = $this->withHeaders([
                'Accept-Language' => 'ar,en;q=0.7',
                'Sec-CH-UA-Mobile' => '?1',
                'X-Accessibility-Mode' => 'screen-reader',
                'X-Reduced-Motion' => 'true',
                'X-Client-Platform' => 'ios',
            ])->requestAs($this->actorFor($uri), $method, $uri, $this->payloadFor($method, $uri) + [
                'locale' => 'ar',
                'direction' => 'rtl',
                'accessibility_mode' => 'screen-reader',
            ]);

            $this->assertControlled($response, $method, $uri);
            $this->assertStringNotContainsString('authorizationexception', strtolower($response->getContent()));
        }
    }
}
