{% extends '__layout__.html' %}
{% block title %}GDPR Erase User{% endblock %}

{% block head %}
<link href="/static/css/admin.css" rel="stylesheet"/>
{% endblock %}

{% block content %}
<div id="main">
    <div class="container" style="max-width: 700px;">
        <a class="mb-2 d-block" href="/admin/manage-users/{{userObj.id}}">← Return to User Page</a>
        <div class="d-flex align-items-center mb-3">
            <img height="100px" style="aspect-ratio: 1/1;" class="rounded-2" src="/Thumbs/Avatar.ashx?userId={{userObj.id}}&x=100&y=100">
            <div class="ms-3">
                <h1 class="m-0 text-danger">GDPR Erase <span class="text-body">{{userObj.username}}</span></h1>
                <p class="text-secondary m-0" style="font-size: 12px;">UserId: <span class="text-body">{{userObj.id}}</span></p>
            </div>
        </div>

        {% with messages = get_flashed_messages() %}
        {% if messages %}
        <div>
            {% for message in messages %}
                <div class="alert border border-danger p-2 text-center messagealerts">
                    {{ message }}
                </div>
            {% endfor %}
        </div>
        {% endif %}
        {% endwith %}

        <div class="alert alert-danger">
            <p class="fw-bold m-0">This is permanent and cannot be undone.</p>
            <p class="m-0 mt-2">This will, right now:</p>
            <ul class="m-0">
                <li>Rename the account, wipe the password (locking the account permanently) and clear the bio</li>
                <li>Log out and revoke every session we have a record of for this user</li>
                <li>Delete their email, linked Discord account, login history, HWID logs, and past usernames</li>
                <li>Delete their friends, followers/following, and group memberships</li>
                <li>Delete their group wall posts, and blank out the content of messages they sent</li>
                <li>Send any limited items they own through the lottery to random online users, then delete everything left in their inventory</li>
                <li>Wipe their avatar (body, worn items, and cached render) and kick them from any active game server</li>
            </ul>
            <p class="m-0 mt-2">Their profile page will 404 immediately after. Trade history and transaction/payment records are kept for economy integrity and legal/tax obligations.</p>
        </div>

        <div class="linebreak"></div>

        <form method="POST" action="/admin/manage-users/{{userObj.id}}/gdpr-delete">
            <div class="form-floating mt-2">
                <input type="text" class="form-control" name="confirm_username" id="confirm-username-input" placeholder="Username" required autocomplete="off">
                <label for="confirm-username-input">Type "{{userObj.username}}" to confirm</label>
            </div>
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="linebreak"></div>
            <button type="submit" class="btn btn-danger mt-2 w-100 btn-sm" onclick="return confirm('This permanently erases {{userObj.username}}. Are you absolutely sure?');">Permanently Erase This User</button>
        </form>
    </div>
</div>
{% endblock %}
