<?php

namespace Tests\Feature\Api\V1\Support;

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

class ContactControllerTest extends TestCase
{
    use RefreshDatabase;

    public function test_send_requires_valid_payload(): void
    {
        $response = $this->postJson('/api/v1/contact', [
            'email' => 'not-an-email',
        ]);

        $response->assertStatus(422);
    }

    public function test_send_returns_success(): void
    {
        $response = $this->postJson('/api/v1/contact', [
            'name' => 'Test User',
            'email' => 'test@example.com',
            'subject' => 'Hello',
            'message' => 'This is a test message.',
        ]);

        $response->assertStatus(201);
        $response->assertJsonStructure(['data' => ['contact' => ['email_sent', 'recipient']]]);
    }
}
