<?php

it('serves the privacy policy with required content', function (): void {
    $response = $this->get('/legal/privacy');

    $response->assertStatus(200);
    $response->assertSeeText('Privacy Policy');
    $response->assertSeeText('data controller');
    $response->assertSeeText('UK GDPR');
    $response->assertSeeText('Last updated:');
});

it('serves the terms of service with required content', function (): void {
    $response = $this->get('/legal/terms');

    $response->assertStatus(200);
    $response->assertSeeText('Terms of Service');
    $response->assertSeeText('subscription');
    $response->assertSeeText('England and Wales');
});

it('serves the refund policy with cooling-off content', function (): void {
    $response = $this->get('/legal/refund');

    $response->assertStatus(200);
    $response->assertSeeText('Refund');
    $response->assertSeeText('14-day');
    $response->assertSeeText('Consumer Contracts');
});

it('serves the cookie policy with essential-cookie content', function (): void {
    $response = $this->get('/legal/cookies');

    $response->assertStatus(200);
    $response->assertSeeText('Cookie Policy');
    $response->assertSeeText('essential');
});

it('does not render the SPA mount point on legal pages', function (string $path): void {
    $response = $this->get($path);

    $response->assertStatus(200);
    $response->assertDontSee('<div id="app"></div>', false);
})->with([
    '/legal/privacy',
    '/legal/terms',
    '/legal/refund',
    '/legal/cookies',
]);

it('cross-links between legal pages', function (): void {
    $this->get('/legal/privacy')->assertSee(route('legal.cookies'), false);
    $this->get('/legal/terms')->assertSee(route('legal.refund'), false);
});

it('is launch-ready: no placeholders and the correct contact domain', function (string $path): void {
    $response = $this->get($path);

    $response->assertStatus(200);
    $response->assertDontSee('[PLACEHOLDER', false);
    $response->assertDontSee('hello@fuelalert.co.uk', false);
    $response->assertSee('hello@fuel-alert.co.uk', false);
})->with([
    '/legal/privacy',
    '/legal/terms',
    '/legal/refund',
    '/legal/cookies',
]);
