<?php

namespace Tests\Feature\Api\V1\Auth;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class RegisterPayloadDebugTest extends TestCase
{
    use RefreshDatabase;

    public function test_debug_payload_shows_json_body(): void
    {
        $payload = [
            'firstname' => 'Parent',
            'lastname' => 'User',
            'gender' => 'Male',
            'email' => 'parent@example.com',
            'confirm_email' => 'parent@example.com',
            'cellphone' => '5555555555',
            'address_street' => '123 Main',
            'apt' => 'A',
            'city' => 'City',
            'state' => 'CT',
            'zip' => '12345',
            'accept_school_policy' => 1,
            'captcha' => 'ABCD',
            'is_parent' => 1,
            'no_second_parent_info' => 1,
        ];

        $response = $this->withHeaders(['X-Debug-Request' => '1'])
            ->postJson('/api/v1/auth/register', $payload);

        $response->assertOk();
        $response->assertJsonPath('ok', true);
        $response->assertJsonFragment(['email' => 'parent@example.com']);
        $response->assertJsonPath('debug.json_all.email', 'parent@example.com');
    }
}
