<?php

namespace Lc\SovBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * This is the class that validates and merges configuration from your app/config files
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('lc_sov');
        $rootNode = $treeBuilder->getRootNode();

        $rootNode
            ->children()
            //->scalarNode('dashboard_default')->defaultValue('App\Controller\Admin\DashboardController')->end()
                ->scalarNode('homepage_route')->end()
                ->arrayNode('login_redirection')
                    ->children()
                        ->scalarNode('redirect_referer')
                            ->defaultValue(true)
                        ->end()
                        ->arrayNode('roles_redirection')
                            ->arrayPrototype()
                                ->children()
                                    ->scalarNode('role')->end()
                                    ->scalarNode('redirect')->end()
                                ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();


        return $treeBuilder;
    }
}
