{% load i18n %}
{% comment %}
Bootstrap-5 modal partial: launch-audit confirm. Included only when
``perms.aa_discord_audit.run_audit`` is true; the surrounding template
guards the include + the trigger button so a viewer-without-run_audit
never sees the modal markup or its policy-summary data.
{% endcomment %}
<div class="modal fade"
     id="launch-audit-modal"
     tabindex="-1"
     aria-labelledby="launch-audit-modal-label"
     aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="launch-audit-modal-label">
                    {% translate "Launch Audit" %}
                </h5>
                <button type="button"
                        class="btn-close"
                        data-bs-dismiss="modal"
                        aria-label="{% translate 'Close' %}"></button>
            </div>
            <div class="modal-body">
                <div class="alert alert-warning">
                    {% translate "This will start a real audit run. Depending on the configured policy it may strip Discord roles and kick members." %}
                </div>
                <p class="mb-2">
                    <strong>{% translate "Policy mode:" %}</strong>
                    {% if policy_destructive %}
                        <span class="badge bg-danger">{% translate "destructive" %}</span>
                    {% else %}
                        <span class="badge bg-secondary">{% translate "report-only" %}</span>
                    {% endif %}
                </p>
                <p class="mb-2">
                    <strong>{% translate "Initial acknowledgement:" %}</strong>
                    {% if has_initial_ack %}
                        <span class="badge bg-success">{% translate "present" %}</span>
                    {% else %}
                        <span class="badge bg-warning">{% translate "missing" %}</span>
                    {% endif %}
                </p>
                {% if not has_initial_ack %}
                    <div class="alert alert-danger">
                        {% blocktranslate %}Run <code>audit_acknowledge_initial</code> from the CLI before launching an audit.{% endblocktranslate %}
                    </div>
                {% endif %}
            </div>
            <div class="modal-footer">
                <button type="button"
                        class="btn btn-secondary"
                        data-bs-dismiss="modal">
                    {% translate "Cancel" %}
                </button>
                {% if has_initial_ack %}
                    <form method="post"
                          action="{% url 'aa_discord_audit:run_launch' %}"
                          class="d-inline">
                        {% csrf_token %}
                        <input type="hidden"
                               name="idempotency_token"
                               value="{{ launch_idempotency_token }}">
                        <button type="submit" class="btn btn-danger">
                            {% translate "Confirm Launch" %}
                        </button>
                    </form>
                {% endif %}
            </div>
        </div>
    </div>
</div>
