<?php

namespace Ayaline\Bundle\EzCarteInteractiveBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class AyalineEzCarteInteractiveExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');
        $container->setParameter('map_setting.zoom', $config['map_setting_zoom']);
        $container->setParameter('map_setting.latitude', $config['map_setting_latitude']);
        $container->setParameter('map_setting.longitude', $config['map_setting_longitude']);
        $container->setParameter('map_setting.type', $config['map_setting_type']);
        $container->setParameter('map_setting.mapproximite', $config['map_setting_mapproximite']);
        $container->setParameter('sit_section', $config['sit_section']);
        $container->setParameter('sit_categories', $config['sit_categories']);
        $container->setParameter('criteres', $config['criteres']);
        $container->setParameter('modalites', $config['modalites']);
        $container->setParameter('operateurCritere', $config['operateurCritere']);
        $container->setParameter('rootCartoSitUrl', $config['rootCartoSitUrl']);
        $container->setParameter('idcritere', $config['idcritere']);
        $container->setParameter('idmodaliteLatitude', $config['idmodaliteLatitude']);
        $container->setParameter('idmodaliteLongitude', $config['idmodaliteLongitude']);
        $container->setParameter('URLCache', $config['URLCache']);
        $container->setParameter('DureeCache', $config['DureeCache']);
        $container->setParameter('URLParams', $config['URLParams']);

    }
}
