<?php

namespace Tests\Feature;

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

class JourneyPagesUpdateTest extends TestCase
{
    use RefreshDatabase;

    public function test_individuals_page_uses_new_three_path_structure(): void
    {
        $this->get('/start/individuals')
            ->assertOk()
            ->assertSee('Individuals')
            ->assertSee('Financial Health Check')
            ->assertSee('Debt Management')
            ->assertSee('Money Personality')
            ->assertSee('/debt', false)
            ->assertDontSee('For You &amp; Your Family', false);
    }

    public function test_corporates_page_focuses_on_companies_not_chamas_or_groups(): void
    {
        $this->get('/start/corporates')
            ->assertOk()
            ->assertSee('Companies')
            ->assertSee('Book a discovery call')
            ->assertSee('Staff Financial Wellness Programmes')
            ->assertSee('Lunch and Learn')
            ->assertSee('Company')
            ->assertDontSee('Chama')
            ->assertDontSee('group coaching')
            ->assertDontSee('1-on-1 or group');
    }

    public function test_diaspora_page_uses_capitalized_diaspora_and_new_positioning(): void
    {
        $this->get('/start/diaspora')
            ->assertOk()
            ->assertSee('Diaspora')
            ->assertSee('passive income')
            ->assertSee('Verify before you invest')
            ->assertSee('Diaspora ROI calculator')
            ->assertDontSee('For the diaspora');
    }

    public function test_company_inquiry_stores_structured_intake_fields(): void
    {
        $this->post('/contact', [
            'type' => 'corporate',
            'name' => 'Amina Otieno',
            'email' => 'amina@example.com',
            'phone' => '+254700000000',
            'organization' => 'Acme Ltd',
            'event_name' => 'Staff Money Day',
            'event_date' => '2026-08-07',
            'audience_profile' => 'Mid-level / supervisors',
            'staff_size' => 75,
            'event_format' => 'Lunch and Learn',
            'delivery_mode' => 'Hybrid',
            'venue' => 'Nairobi HQ',
            'session_duration' => '1-2 hours',
            'topics' => ['Debt', 'Saving', 'Investing'],
            'message' => 'We need a practical session for our staff.',
        ])->assertRedirect()->assertSessionHas('inquiry_sent');

        $this->assertDatabaseHas('inquiries', [
            'type' => 'corporate',
            'email' => 'amina@example.com',
            'organization' => 'Acme Ltd',
            'event_name' => 'Staff Money Day',
            'event_date' => '2026-08-07 00:00:00',
            'audience_profile' => 'Mid-level / supervisors',
            'staff_size' => 75,
            'event_format' => 'Lunch and Learn',
            'delivery_mode' => 'Hybrid',
            'venue' => 'Nairobi HQ',
            'session_duration' => '1-2 hours',
        ]);
    }
}
