apiVersion: v1
kind: Secret
metadata:
  name: console-html
type: Opaque
stringData:
  index.html: |
    <!DOCTYPE html>
    <html>
    <head>
        <title>JamKazam Console</title>
        <style>
            body { font-family: sans-serif; text-align: center; padding: 50px; background: #f4f4f4; }
            .container { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: inline-block; }
            h1 { color: #333; }
            .links { margin-top: 30px; display: grid; gap: 15px; }
            a { display: block; padding: 10px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; transition: background 0.2s; }
            a:hover { background: #0056b3; }
            .wiki-link { background: #28a745 !important; }
            .wiki-link:hover { background: #218838 !important; }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>JamKazam Console</h1>
            <p>Welcome to the central management hub.</p>
            <div class="links">
                <a href="{{ .Values.links.authelia }}">Identity Provider (Authelia)</a>
                <a href="{{ .Values.links.monitoring }}">Monitoring (Grafana)</a>
                <a href="{{ .Values.links.argocd }}">Deployment (ArgoCD)</a>
                <a href="/docs" class="wiki-link">Internal Documentation (Wiki)</a>
            </div>
        </div>
    </body>
    </html>

  docs-index.html: |
    <!DOCTYPE html>
    <html>
    <head>
        <title>JamKazam Internal Documentation</title>
        <style>
            body { font-family: sans-serif; padding: 50px; background: #f4f4f4; color: #333; line-height: 1.6; }
            .container { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
            h1 { border-bottom: 2px solid #eee; padding-bottom: 10px; }
            .nav { margin-bottom: 20px; }
            .nav a { color: #007bff; text-decoration: none; }
            .pages { list-style: none; padding: 0; }
            .pages li { margin: 10px 0; }
            .pages a { font-size: 1.2em; color: #007bff; text-decoration: none; }
            .pages a:hover { text-decoration: underline; }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="nav"><a href="/">&larr; Back to Console</a></div>
            <h1>JamKazam Internal Documentation</h1>
            <p>Welcome to the technical wiki for JamKazam infrastructure and development.</p>
            <ul class="pages">
                <li><a href="/docs/deployment">Deployment Architecture (HTTP Request Flow)</a></li>
            </ul>
            <hr style="margin: 40px 0; border: 0; border-top: 1px solid #eee;">
            <p style="color: #666; font-size: 0.9em;">To add more pages, update <code>secret.yaml</code> and map them in <code>deployment.yaml</code>.</p>
        </div>
    </body>
    </html>

  docs-deployment.html: |
    <!DOCTYPE html>
    <html>
    <head>
        <title>Deployment Architecture - JamKazam Docs</title>
        <style>
            body { font-family: sans-serif; padding: 50px; background: #f4f4f4; color: #333; line-height: 1.6; }
            .container { max-width: 1000px; margin: 0 auto; background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
            h1 { border-bottom: 2px solid #eee; padding-bottom: 10px; }
            .nav { margin-bottom: 20px; }
            .nav a { color: #007bff; text-decoration: none; }
            pre { background: #2d2d2d; color: #ccc; padding: 20px; border-radius: 4px; overflow-x: auto; font-family: monospace; line-height: 1.2; }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="nav"><a href="/docs">&larr; Back to Documentation</a></div>
            <h1>Deployment Architecture</h1>
            <p>This diagram shows how an HTTP request for <code>console.jamkazam.com</code> is routed through our Kubernetes environment.</p>
            <pre>
                                  1. Request: https://console.jamkazam.com/
        ┌─────────┐              ────────────────────────────────────────▶
        │         │
        │ BROWSER │              6. Response: 200 OK (Console HTML)
        │         │              ◀───────────────────────────────────────
        └────┬────┘
             │
             ▼
    ┌─────────────────────────┐
    │  INGRESS CONTROLLER     │
    │    (Nginx Ingress)      │
    └────────┬───────▲────────┘
             │       │
             │       │ 2. Sub-request: Check Auth?
             │       │    (auth-url: idp.jamkazam.com/api/authz/auth-request)
             │       └───────────────────────┐
             │                               │
             │         ┌─────────────────────▼──────────────────────┐
             │         │         AUTHELIA (idp.jamkazam.com)        │
             │         │                                            │
             │         │ 3. Check Session Cookie / Auth Status      │
             │         └─────────────────────┬──────────────────────┘
             │                               │
             │         4. Auth Result:       │
             │            200 OK (Authorized)│ OR 401/302 (Redirect to Login)
             │         ◀─────────────────────┘
             │
             │ 5. Forward Request (if 200 OK)
             │    (service: console, port: 80)
             ▼
    ┌─────────────────────────┐
    │     CONSOLE SERVICE     │
    │    (Nginx Container)    │
    │                         │
    │  Mount: /usr/share/     │
    │  nginx/html/            │
    └─────────────────────────┘
            </pre>
        </div>
    </body>
    </html>
