<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title><%= projectName %></title>
  <meta name="description" content="<%= description %>"/>
  <link rel="stylesheet" href="/css/style.css"/>
</head>
<body>
<div class="landing">

  <!-- Top nav -->
  <nav class="landing-nav">
    <div class="landing-brand">
      <span class="brand-mark">SG</span>
      <span class="brand-name"><%= projectName %></span>
    </div>
    <div class="landing-nav-actions">
      <a href="https://wadecalvin9.github.io/Sprygen/" target="_blank" class="btn btn-ghost btn-sm">Sprygen Docs</a>
      <a href="/login.html" class="btn btn-ghost btn-sm">Sign in</a>
      <a href="/register.html" class="btn btn-primary btn-sm">Get started</a>
    </div>
  </nav>

  <!-- Hero -->
  <section class="landing-hero-section">
    <div class="landing-container">
      <div class="status-pill">
        <span class="status-dot"></span>
        <span>Running on Spring Boot 3.x</span>
      </div>
      <h1 class="hero-title">
        Your Spring Boot backend<br/>
        <span class="text-green">is ready.</span>
      </h1>
      <p class="hero-sub">
        Generated by Sprygen. JWT authentication, role-based access control,
        user management and an admin panel — all included.
      </p>
      <div class="hero-actions">
        <a href="/register.html" class="btn btn-primary">Create account</a>
        <a href="/login.html" class="btn btn-outline">Sign in</a>
        <a href="https://wadecalvin9.github.io/Sprygen/" class="btn btn-ghost" target="_blank">Documentation</a>
        <a href="/swagger-ui/index.html" class="btn btn-ghost" target="_blank">API Docs</a>
      </div>
      <div class="tech-pills">
        <span class="tech-pill">Spring Boot 3.x</span>
        <span class="tech-pill">JWT</span>
        <span class="tech-pill">RBAC</span>
        <span class="tech-pill">Spring Data JPA</span>
        <span class="tech-pill">BCrypt</span>
        <span class="tech-pill">Validation</span>
      </div>
    </div>
  </section>

  <!-- API reference -->
  <section class="landing-section">
    <div class="landing-container">
      <div class="section-row">
        <h2 class="section-heading">API Endpoints</h2>
        <a href="/swagger-ui/index.html" class="link-green" target="_blank">Open Swagger UI</a>
      </div>
      <div class="table-wrap">
        <table>
          <thead>
            <tr><th>Method</th><th>Endpoint</th><th>Description</th><th>Access</th></tr>
          </thead>
          <tbody>
            <tr><td><code class="http-post">POST</code></td><td><code>/api/v1/auth/register</code></td><td>Register new account</td><td><span class="badge badge-open">Public</span></td></tr>
            <tr><td><code class="http-post">POST</code></td><td><code>/api/v1/auth/login</code></td><td>Login and receive JWT</td><td><span class="badge badge-open">Public</span></td></tr>
            <tr><td><code class="http-get">GET</code></td><td><code>/api/v1/profile</code></td><td>Get own profile</td><td><span class="badge badge-auth">Auth</span></td></tr>
            <tr><td><code class="http-put">PUT</code></td><td><code>/api/v1/profile</code></td><td>Update profile</td><td><span class="badge badge-auth">Auth</span></td></tr>
            <tr><td><code class="http-put">PUT</code></td><td><code>/api/v1/profile/password</code></td><td>Change password</td><td><span class="badge badge-auth">Auth</span></td></tr>
            <tr><td><code class="http-get">GET</code></td><td><code>/api/v1/admin/users</code></td><td>List all users</td><td><span class="badge badge-admin">Admin</span></td></tr>
            <tr><td><code class="http-put">PUT</code></td><td><code>/api/v1/admin/users/{id}/role</code></td><td>Assign role to user</td><td><span class="badge badge-admin">Admin</span></td></tr>
            <tr><td><code class="http-delete">DELETE</code></td><td><code>/api/v1/admin/users/{id}</code></td><td>Delete user</td><td><span class="badge badge-admin">Admin</span></td></tr>
            <tr><td><code class="http-get">GET</code></td><td><code>/actuator/health</code></td><td>Health check</td><td><span class="badge badge-open">Public</span></td></tr>
          </tbody>
        </table>
      </div>
    </div>
  </section>

  <footer class="landing-footer">
    <span>Generated with Sprygen</span>
    <span><%= projectName %></span>
  </footer>
</div>

<script src="/js/auth.js"></script>
<script>
  // Redirect logged-in users to dashboard
  if (Auth.loggedIn()) window.location.href = '/dashboard.html';
</script>
</body>
</html>
