<!DOCTYPE html>
<html lang="fr">
<head><meta charset="UTF-8"><style>
body { font-family: DejaVu Sans, sans-serif; font-size: 11px; color: #111; }
h1 { font-size: 18px; margin-bottom: 5px; }
h2 { font-size: 14px; margin-top: 20px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 10px; }
th, td { border: 1px solid #ddd; padding: 4px 6px; text-align: left; }
th { background: #f5f5f5; font-weight: bold; }
.header { display: flex; align-items: center; margin-bottom: 15px; }
.logo { width: 60px; margin-right: 15px; }
.meta { color: #666; font-size: 10px; margin-bottom: 15px; }
</style></head>
<body>
{% if logo %}<img src="{{ logo }}" class="logo" alt="Logo">{% endif %}
<h1>Droit d'acces aux donnees personnelles</h1>
<p class="meta">Article 15 du RGPD — Genere le {{ date|date('d/m/Y a H:i') }}</p>
<p>Adresse IP concernee : <strong>{{ ip }}</strong></p>

{% for entry in data %}
<h2>Session #{{ loop.index }} — {{ entry.visitor.createdAt|date('d/m/Y H:i') }}</h2>
<table>
    <tr><th>Appareil</th><td>{{ entry.visitor.deviceType }}</td><th>OS</th><td>{{ entry.visitor.os ?? 'Inconnu' }}</td></tr>
    <tr><th>Navigateur</th><td>{{ entry.visitor.browser ?? 'Inconnu' }}</td><th>Langue</th><td>{{ entry.visitor.language ?? 'Inconnu' }}</td></tr>
    <tr><th>Ecran</th><td>{{ entry.visitor.screenWidth ?? '?' }}x{{ entry.visitor.screenHeight ?? '?' }}</td><th>Compte lie</th><td>{{ entry.visitor.user ? entry.visitor.user.email : 'Non' }}</td></tr>
</table>

{% if entry.events|length > 0 %}
<table>
    <thead><tr><th>Date</th><th>Page</th><th>Titre</th><th>Referrer</th></tr></thead>
    <tbody>
    {% for event in entry.events %}
    <tr>
        <td>{{ event.createdAt|date('d/m/Y H:i') }}</td>
        <td>{{ event.url }}</td>
        <td>{{ event.title ?? '-' }}</td>
        <td>{{ event.referrer ?? '-' }}</td>
    </tr>
    {% endfor %}
    </tbody>
</table>
{% else %}
<p><em>Aucune page visitee enregistree.</em></p>
{% endif %}
{% endfor %}

<p style="margin-top: 20px; font-size: 10px; color: #666;">
Document genere automatiquement par E-Ticket (Association E-Cosplay) conformement au Reglement General sur la Protection des Donnees (RGPD).
</p>
<p style="font-size: 10px; color: #666; margin-top: 10px;">
<strong>Delegue a la Protection des Donnees (DPO)</strong><br>
Identifiant : DPO-167945<br>
Association E-Cosplay — SIREN : 943121517 / RNA : W022006988<br>
42 rue de Saint-Quentin, 02800 Beautor, France<br>
Contact : contact@e-cosplay.fr
</p>
</body>
</html>
