<?php

namespace Tests\Feature\Api\V1\FullSurface;

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

class ApiBatch16NotificationDeliverySuppressionContractTest extends FullSurfaceE2EContractCase
{
    public function test_batch16_notification_suppression_and_delivery_flags_cannot_be_overridden_by_clients(): void
    {
        $routes = $this->apiRoutesContainingAny(['notify', 'notification', 'email', 'sms', 'whatsapp', 'broadcast', 'message', 'support']);

        foreach (array_slice($routes, 0, 45) as $route) {
            $method = $this->primaryMethod($route);
            $uri = $route->uri();
            $response = $this->requestAs($this->parent, $method, $uri, $this->payloadFor($method, $uri) + [
                'force_send' => true,
                'bypass_opt_out' => true,
                'ignore_quiet_hours' => true,
                'recipient_ids' => ['*'],
                'channel' => 'all',
                'from' => "attacker@example.test\r\nBcc: victim@example.test",
            ]);

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