<?php

namespace AutoAdmin\Bundle\BrickBuilder\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class BrickConfigCompilerPass implements CompilerPassInterface
{
    /**
     * @inheritDoc
     */
    public function process(ContainerBuilder $container): void
    {
        $container
            ->getDefinition('twig')
            ->addMethodCall(
                'addGlobal',
                [
                    // global name
                    'aa_brick',
                    // global value
                    [
                        'templates' => [
                            'base_brick' => '@AutoAdminBrickBuilder/brick/base_brick.html.twig',
                            'container_brick' => '@AutoAdminBrickBuilder/brick/container_brick.html.twig',
                            'html_brick' => '@AutoAdminBrickBuilder/brick/html_brick.html.twig',
                            'root_brick' => '@AutoAdminBrickBuilder/brick/root_brick.html.twig',
                        ],
                    ],
                ]
            );
    }
}
