<?php

namespace Tests\Unit;

use Tests\TestCase;

class CampaignImagePromptDisplayTest extends TestCase
{
    public function test_the_image_prompt_is_shown_in_a_code_block(): void
    {
        $action = 'Designer brief. Control headline: “Your AI Models, One Workspace”. Image prompt (text only): 4:5 Meta feed still. Exact on-image line: “Your AI Models, One Workspace”. High-contrast type, plain background, no extra slogans, no button on the image. The studio makes the still. This app does not generate it.';

        $html = view('campaigns.partials.performance-brief-full', [
            'row' => [
                'brief' => [
                    'next_actions' => [
                        'Pause is not the move on this $40.00 week.',
                        $action,
                    ],
                ],
            ],
        ])->render();

        $this->assertStringContainsString('Pause is not the move on this $40.00 week.', $html);
        $this->assertStringContainsString('<pre class="mb-perf-prompt"><code>', $html);
        $this->assertStringContainsString('4:5 Meta feed still. Exact on-image line: “Your AI Models, One Workspace”.', $html);
        $this->assertStringContainsString('Control headline', $html);
        $this->assertStringNotContainsString('<pre class="mb-perf-prompt"><code>Designer brief', $html);
        $this->assertStringContainsString('The studio makes the still.', $html);
        $this->assertMatchesRegularExpression('/<span class="mb-perf-action-note">The studio makes the still\./', $html);

        $short = view('campaigns.partials.performance-brief-short', [
            'row' => [
                'brief' => [
                    'issue' => 'The ad is not getting clicks.',
                    'short_lines' => [$action],
                ],
            ],
        ])->render();

        $this->assertStringContainsString('<pre class="mb-perf-prompt"><code>', $short);
    }
}
