<?php

namespace PloverCRM\Modules\PushNotifications\Helpers;

use PloverCRM\Common\BaseLogViewer;

/**
 * Log Viewer Helper
 * 
 * Handles viewing and downloading push notification logs
 */
class LogViewer extends BaseLogViewer
{
    /**
     * Constructor
     */
    public function __construct()
    {
        parent::__construct('push-notifications', 'push-notifications');
    }

    /**
     * Render log viewer for push notifications
     */
    public static function render(): void
    {
        $viewer = new self();
        $logs = $viewer->getRecentLogs();

        echo '<div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #ddd;">';
        echo '<h3>Push Notification Logs</h3>';
        echo '<p>View recent push notification logs.</p>';

        $viewer->renderLogEntries($logs);

        if (!empty($logs)) {
            echo '<div style="margin-top: 15px;">';
            echo \PloverCRM\Common\BaseLogViewer::getDownloadButton('push-notifications');
            echo '</div>';
        }

        echo '</div>';
    }
}
