<?php

namespace Tests\Fixtures;

class PromptLandingPageEditorDocument
{
    public static function html(): string
    {
        return <<<'HTML'
<header id="top" data-analytics="header">
    <a href="/?utm_campaign=keep-me" data-cta="home">Home</a>
</header>
<section id="hero" class="hero" data-lp-section="hero">
    <h1 id="headline">Grow Your Business Faster</h1>
    <p class="lead">A supporting line with <strong>emphasis</strong>.</p>
    <a class="btn" id="hero-cta" href="/signup?utm_source=hero" rel="noopener">Get started</a>
</section>
<section id="features" class="features" data-lp-section="features">
    <article class="card" data-feature="one"><h2>Feature one</h2><p>Nested card copy.</p></article>
    <svg width="24" height="24" aria-hidden="true"><circle cx="12" cy="12" r="8"></circle></svg>
</section>
<section id="contact" data-lp-section="contact">
    <form id="lead-form" class="lead-form" method="post" name="lead" data-form="lead">
        <input type="hidden" name="source" value="landing" data-track="source">
        <label for="name">Name</label>
        <input id="name" type="text" name="name" required>
        <label for="email">Email</label>
        <input id="email" type="email" name="email" required>
        <label for="phone">Phone</label>
        <input id="phone" type="tel" name="phone">
        <button type="submit" id="submit-lead">Send details</button>
    </form>
</section>
<footer id="footer" data-analytics="footer"><p>Footer text</p></footer>
HTML;
    }

    public static function css(): string
    {
        return <<<'CSS'
:root { --theme: #5b5bd6; --text: #111; --background: #fff; }
.hero h1 { font-size: 56px; color: #111111; }
.lead-form { max-width: 32rem; }
@media (max-width: 767px) {
  .hero h1 { font-size: 32px; }
  .features { padding: 24px; }
}
CSS;
    }

    public static function js(): string
    {
        return <<<'JS'
(function () {
    var form = document.getElementById('lead-form');
    var headline = document.getElementById('headline');
    if (form) {
        form.addEventListener('submit', function () {
            window.__leadFormSeen = true;
        });
    }
    if (headline) {
        headline.setAttribute('data-js-ready', '1');
    }
})();
JS;
    }

    public static function fullHtml(?string $body = null): string
    {
        $body ??= self::html();

        return <<<HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Landing</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<script src="https://cdn.example.test/lp-analytics.js"></script>
<script>
window.LP_PAGE = { id: 39 };
</script>
</head>
<body class="lp-body">
{$body}
</body>
</html>
HTML;
    }
}
