<?php

namespace VulnTitan\Admin\Pages;

class LiveFeed extends TemplateParts
{
    public static function render()
    { ?>
        <div class="wrap vulntitan-wrapper vulntitan-wrapper--firewall">
            <div class="vulntitan-layout">
                <div class="vulntitan-main">
                    <?php self::header(); ?>

                    <div class="vulntitan-dashboard-section-wrapper vulntitan-firewall-page" id="vulntitan-firewall-page">
                        <section class="vulntitan-firewall-hero">
                            <div class="vulntitan-firewall-hero-content">
                                <span class="vulntitan-elite-kicker"><?php esc_html_e('Security Telemetry', 'vulntitan'); ?></span>
                                <h2 class="vulntitan-firewall-title"><?php esc_html_e('Live Security Feed', 'vulntitan'); ?></h2>
                                <p class="vulntitan-firewall-subtitle"><?php esc_html_e('Monitor real-time firewall, login, comment, and form activity with instant context for every event.', 'vulntitan'); ?></p>
                                <div class="vulntitan-firewall-hero-metrics">
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Live Activity', 'vulntitan'); ?></span>
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Instant Context', 'vulntitan'); ?></span>
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Rapid Response', 'vulntitan'); ?></span>
                                </div>
                            </div>
                            <div class="vulntitan-firewall-hero-panel">
                                <div class="vulntitan-panel-title"><?php esc_html_e('Live Overview', 'vulntitan'); ?></div>
                                <div id="vulntitan-firewall-overview" class="vulntitan-firewall-overview"></div>
                            </div>
                        </section>

                        <div id="vulntitan-firewall-feedback" class="vulntitan-firewall-feedback" style="display:none;"></div>

                        <div class="vulntitan-firewall-grid">
                            <section class="vulntitan-firewall-panel vulntitan-firewall-panel--logs">
                                <div class="vulntitan-firewall-panel-head vulntitan-firewall-panel-head--feed">
                                    <div class="vulntitan-firewall-panel-head-copy">
                                        <h3 class="vulntitan-firewall-panel-title"><?php esc_html_e('Live Security Feed', 'vulntitan'); ?></h3>
                                        <span id="vulntitan-firewall-feed-meta" class="vulntitan-firewall-panel-meta"><?php esc_html_e('Auto-refresh every 5 seconds', 'vulntitan'); ?></span>
                                    </div>
                                    <div class="vulntitan-firewall-feed-live">
                                        <span id="vulntitan-firewall-feed-status" class="vulntitan-firewall-live-pill is-live"><?php esc_html_e('Live', 'vulntitan'); ?></span>
                                        <button type="button" class="vulntitan-fw-btn vulntitan-fw-btn-secondary vulntitan-fw-btn-compact" id="vulntitan-firewall-feed-toggle"><?php esc_html_e('Pause', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-fw-btn vulntitan-fw-btn-danger vulntitan-fw-btn-compact" id="vulntitan-firewall-clear-logs"><?php esc_html_e('Clear Logs', 'vulntitan'); ?></button>
                                    </div>
                                </div>
                                <div class="vulntitan-firewall-feed-toolbar" role="toolbar" aria-label="<?php esc_attr_e('Live security feed controls', 'vulntitan'); ?>">
                                    <div class="vulntitan-firewall-feed-filters" role="group" aria-label="<?php esc_attr_e('Feed filters', 'vulntitan'); ?>">
                                        <button type="button" class="vulntitan-firewall-filter-chip is-active" data-firewall-feed-filter="all"><?php esc_html_e('All', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-firewall-filter-chip" data-firewall-feed-filter="blocked"><?php esc_html_e('Blocked', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-firewall-filter-chip" data-firewall-feed-filter="forms"><?php esc_html_e('Forms', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-firewall-filter-chip" data-firewall-feed-filter="login"><?php esc_html_e('Login', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-firewall-filter-chip" data-firewall-feed-filter="spam"><?php esc_html_e('Spam', 'vulntitan'); ?></button>
                                        <button type="button" class="vulntitan-firewall-filter-chip" data-firewall-feed-filter="waf"><?php esc_html_e('WAF', 'vulntitan'); ?></button>
                                    </div>
                                    <label class="vulntitan-firewall-feed-search">
                                        <span class="screen-reader-text"><?php esc_html_e('Search live security feed', 'vulntitan'); ?></span>
                                        <input
                                            type="search"
                                            id="vulntitan-firewall-feed-search"
                                            class="vulntitan-firewall-input"
                                            placeholder="<?php echo esc_attr__('Search IP, path, username, or rule', 'vulntitan'); ?>"
                                            autocomplete="off"
                                            spellcheck="false"
                                        >
                                    </label>
                                </div>
                                <div id="vulntitan-firewall-feed-summary" class="vulntitan-firewall-feed-summary" aria-live="polite"></div>
                                <div id="vulntitan-firewall-log-detail" class="vulntitan-firewall-log-detail" hidden></div>
                                <div id="vulntitan-firewall-logs-empty" class="vulntitan-firewall-empty">
                                    <?php esc_html_e('No firewall events recorded yet.', 'vulntitan'); ?>
                                </div>
                                <div id="vulntitan-firewall-logs-list" class="vulntitan-firewall-log-list"></div>
                                <div id="vulntitan-firewall-load-more" class="vulntitan-firewall-load-more" hidden>
                                    <button type="button" class="vulntitan-fw-btn vulntitan-fw-btn-secondary" data-firewall-load-more>
                                        <?php esc_html_e('Load more', 'vulntitan'); ?>
                                    </button>
                                </div>
                            </section>
                        </div>
                    </div>
                </div>
            </div>
            <?php self::footer(); ?>
        </div>
    <?php
    }
}
