{% extends "base.html" %}

{% block title %}
	{{ _("Delete user %(username)s", username=user.username) }}
{% endblock %}

{% block content %}
	<form method="POST" action="" class="card box_grey">
		<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />

		<h3 class="card-header">{{ self.title() }}</h3>
		<div class="card-body">
			<p><b>{{ _("Deleting is permanent") }}</b></p>

			{% if can_delete %}
				<p>
					{{ _("This will delete your account, removing %(threads)d threads and %(replies)d replies.",
							threads=user.threads.count(), replies=user.replies.count()) }}
				</p>
			{% else %}
				<p>
					{{ _("As you have packages and/or forum threads, your account cannot be fully deleted.") }}
					{{ _("Instead, your account will be deactivated and all personal information wiped - including %(threads)d threads and %(replies)d replies.",
							threads=user.threads.count(), replies=user.replies.count()) }}
					{{ _("See the privacy policy for more information.") }}
				</p>
			{% endif %}

			<a class="btn btn-secondary me-3" href="{{ url_for('users.account', username=user.username) }}">
				{{ _("Cancel") }}
			</a>
			<input type="submit"
				{% if can_delete %}
					name="delete" value="{{ _('Delete') }}"
				{% else %}
					name="deactivate" value="{{ _('Deactivate') }}"
				{% endif %}
				class="btn btn-danger" />
			{% if not can_delete and current_user.rank.at_least(current_user.rank.ADMIN) %}
				<input type="submit" name="delete" value="{{ _('Delete Anyway') }}" class="btn btn-danger ms-3" />
			{% endif %}
		</div>
	</form>
{% endblock %}
