<?php

namespace AutoAdmin\Bundle\Content\Twig\Extension;

use AutoAdmin\Bundle\Content\Context\SiteContext;
use AutoAdmin\Bundle\Content\Site\SiteContextHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class SiteContextExtension extends AbstractExtension
{
    public function __construct(
        protected SiteContextHelper $siteContextHelper,
    ) {
    }

    public function getFunctions(): array
    {
        return [
            new TwigFunction('aa_site_context', [$this, 'getCurrentContext']),
        ];
    }

    public function getCurrentContext(): ?SiteContext
    {
        return $this->siteContextHelper->getCurrentContext();
    }
}
