<?php

declare(strict_types=1);

/*
 * Chill is a software for social workers
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Chill\MainBundle\Templating;

use Chill\MainBundle\Service\VersionProvider;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class VersionRenderExtension extends AbstractExtension
{
    public function __construct(
        private readonly VersionProvider $versionProvider,
    ) {}

    public function getFunctions(): array
    {
        return [
            new TwigFunction('get_chill_version', $this->getChillVersion(...)),
        ];
    }

    public function getChillVersion(): string
    {
        return $this->versionProvider->getFormattedVersion();
    }
}
