{% extends "base.html" %}

{% block title %}Admin Trigger{% endblock %}
{% block page_id %}trigger{% endblock %}
{% block page_title %}Trigger{% endblock %}
{% block eyebrow %}Automation{% endblock %}

{% block content %}
    <!-- Flash Messages Container -->
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="flash-container">
                {% for category, message in messages %}
                    <div class="flash {{ category }}">
                        {{ message }}
                        <button class="flash-close" onclick="this.parentElement.remove()">&times;</button>
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    <section class="panel-stack">
        <article class="glass-card panel-card trigger-card">
            <div class="panel-header">
                <div>
                    <p class="eyebrow">Pipeline</p>
                    <h3>Run Face Matching + Email Sending</h3>
                </div>
            </div>
            <p class="hero-copy">This runs user face indexing first, then triggers face matching and email delivery using the existing project services.</p>
            <button class="primary-btn trigger-btn" id="runTriggerButton" type="button">Run Face Matching + Email Sending</button>
            <pre id="triggerResponse" class="response-box compact">Idle.</pre>
        </article>
    </section>
{% endblock %}
