<?php
declare(strict_types=1);

/**
 * @var \Magento\Framework\View\Element\Template $block
 * @var \Magento\Framework\Escaper $escaper
 * @var \ClawRock\Debug\Model\Collector\EventCollector $collector
 */
$collector = $block->getCollector();
?>
<div class="sf-toolbar-block sf-toolbar-block-<?= /* @noEscape */ $collector->getName() ?>">
    <a target="_blank" href="<?= $escaper->escapeUrl($block->getProfilerUrl()); ?>">
        <div class="sf-toolbar-icon">
            <img src="<?= /* @noEscape */ $block->getViewFileUrl('ClawRock_Debug::images/collector/event.svg'); ?>"
                 alt="<?= $escaper->escapeHtmlAttr(__('Event')) ?>"/>
            <span class="sf-toolbar-value"><?= /* @noEscape */ $collector->getObserversCount() ?></span>
            <span class="sf-toolbar-info-piece-additional-detail">
                <span class="sf-toolbar-label"><?= $escaper->escapeHtml(__('in')); ?></span>
                <span class="sf-toolbar-value"><?= /* @noEscape */ $collector->getTime() ?></span>
                <span class="sf-toolbar-label">ms</span>
            </span>
        </div>
    </a>
    <div class="sf-toolbar-info">
        <div class="sf-toolbar-info-group">
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Events dispatched')); ?></strong>
                <span class="sf-toolbar-status"><?= count($collector->getEvents()) ?></span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Observers executed')); ?></strong>
                <span class="sf-toolbar-status"><?= /* @noEscape */ $collector->getObserversCount() ?></span>
            </div>
            <div class="sf-toolbar-info-piece">
                <strong><?= $escaper->escapeHtml(__('Time')); ?></strong>
                <span class="sf-toolbar-status"><?= /* @noEscape */ $collector->getTime(); ?> ms</span>
            </div>
        </div>
    </div>
</div>
