<?php

/**
 * @package         Tassos Code Snippets
 * @version         1.0.1-RC2 Free
 *
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            https://www.tassos.gr
 * @copyright       Copyright © 2026 Tassos Marinos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
 */

namespace Tassos\CodeSnippets\Administrator\Location;

defined('_JEXEC') or die;

/**
 * Site Header Location
 * 
 * Injects snippets into the <head> section of frontend pages
 * using Joomla's WebAssetManager.
 */
class SiteHeader extends AbstractLocation
{
    /**
     * Get the Joomla event for injection
     *
     * @return string
     */
    public function getEvent(): ?string
    {
        return 'onBeforeCompileHead';
    }

    /**
     * Check if this location can run
     *
     * @return bool
     */
    public function canRun(): bool
    {
        return $this->isSite() && $this->isHtmlDocument();
    }

    /**
     * Inject snippets via WebAssetManager
     *
     * @return void
     */
    public function inject(): void
    {
        $this->injectViaWebAsset();
    }
}
