{% extends "base.html" %}

{% set active_page = "Database" %}

{% block styles %}
{% if result is none %}
    <meta http-equiv="refresh" content="10 URL=/database/database_binary_search_results.html?request_id={{ request_id }}&only_firmware={{ only_firmware }}">
{% endif %}
{% endblock %}

{% block body %}

<div class="row justify-content-center">
    <div class="col-xl-6 col-lg-8 col-md-10 mt-4">
        <h3 class="mb-3">Binary Pattern Search Results</h3>
        <div class="list-group">
            {% if yara_rules %}
                <button data-toggle="collapse" data-target="#yara_rules" class="list-group-item list-group-item-primary">
                    Show yara rules
                </button>
                <div id="yara_rules" class="collapse">
                    <pre class="border rounded p-2 bg-light">{{ yara_rules }}</pre>
                </div>
            {% endif %}
            {% if error %}
                <h3>Error: {{ error }}</h3>
            {% else %}
                <div class="alert alert-primary">
                    <i class="fas fa-sync-alt fa-spin"></i>
                    Waiting for results...
                </div>
                <div class="alert alert-warning">
                    <i class="fas fa-hourglass-half"></i>
                    <strong>Warning:</strong> The analysis might take several hours. You may bookmark this page and come back later.
                </div>
            {% endif %}
        </div>
    </div>
</div>

{% endblock %}