{% extends "base.html" %}

{% block title %}Injection History - Memory MCP Dashboard{% endblock %}

{% block content %}
<div class="space-y-6">
    <!-- Page Header -->
    <div>
        <h1 class="text-2xl font-bold text-white">Injection History</h1>
        <p class="text-gray-400 mt-1">Track when memories are injected into Claude's context</p>
    </div>

    <!-- Stats Cards -->
    <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
        <div class="bg-dark-900 rounded-lg border border-gray-800 p-4">
            <p class="text-xs text-gray-400">Today</p>
            <p class="text-2xl font-bold text-white">{{ injection_stats.today }}</p>
        </div>
        <div class="bg-dark-900 rounded-lg border border-gray-800 p-4">
            <p class="text-xs text-gray-400">This Week</p>
            <p class="text-2xl font-bold text-white">{{ injection_stats.week }}</p>
        </div>
        <div class="bg-dark-900 rounded-lg border border-gray-800 p-4">
            <p class="text-xs text-gray-400">Hot Cache Injections</p>
            <p class="text-2xl font-bold text-orange-400">{{ injection_stats.hot_cache }}</p>
        </div>
        <div class="bg-dark-900 rounded-lg border border-gray-800 p-4">
            <p class="text-xs text-gray-400">Working Set Injections</p>
            <p class="text-2xl font-bold text-blue-400">{{ injection_stats.working_set }}</p>
        </div>
    </div>

    <!-- Filter -->
    <div class="bg-dark-900 rounded-lg border border-gray-800 p-4">
        <div class="flex gap-4">
            <select name="resource_filter"
                    hx-get="/api/injections"
                    hx-trigger="change"
                    hx-target="#injections-table"
                    hx-include="[name='days']"
                    class="px-3 py-2 bg-dark-800 border border-gray-700 rounded-lg text-gray-200 focus:outline-none focus:border-blue-500">
                <option value="" {% if not resource_filter %}selected{% endif %}>All resources</option>
                <option value="hot-cache" {% if resource_filter == 'hot-cache' %}selected{% endif %}>Hot Cache</option>
                <option value="working-set" {% if resource_filter == 'working-set' %}selected{% endif %}>Working Set</option>
            </select>
            <select name="days"
                    hx-get="/api/injections"
                    hx-trigger="change"
                    hx-target="#injections-table"
                    hx-include="[name='resource_filter']"
                    class="px-3 py-2 bg-dark-800 border border-gray-700 rounded-lg text-gray-200 focus:outline-none focus:border-blue-500">
                <option value="1" {% if days == 1 %}selected{% endif %}>Last 24 hours</option>
                <option value="7" {% if days == 7 %}selected{% endif %}>Last 7 days</option>
                <option value="30" {% if days == 30 %}selected{% endif %}>Last 30 days</option>
            </select>
        </div>
    </div>

    <!-- Injections Table -->
    <div class="bg-dark-900 rounded-lg border border-gray-800 overflow-hidden">
        <div id="injections-table">
            {% include "partials/injection_table.html" %}
        </div>
    </div>
</div>
{% endblock %}
