<?xml version="1.0" encoding="UTF-8"?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="jms_di_extra.metadata.driver.annotation_driver.class">JMS\DiExtraBundle\Metadata\Driver\AnnotationDriver</parameter>
        
        <parameter key="jms_di_extra.metadata.metadata_factory.class">Metadata\MetadataFactory</parameter>
        <parameter key="jms_di_extra.metadata.cache.file_cache.class">Metadata\Cache\FileCache</parameter>
        
        <parameter key="jms_di_extra.metadata.converter.class">JMS\DiExtraBundle\Metadata\MetadataConverter</parameter>
        <parameter key="jms_di_extra.controller_resolver.class">JMS\DiExtraBundle\HttpKernel\ControllerResolver</parameter>
        
        <parameter key="jms_di_extra.template_listener.class">JMS\DiExtraBundle\EventListener\TemplateListener</parameter>
        <parameter key="jms_di_extra.controller_listener.class">JMS\DiExtraBundle\EventListener\ControllerListener</parameter>
    </parameters>

    <services>
        <!-- Metadata Drivers -->
        <service id="jms_di_extra.metadata.driver.annotation_driver" class="%jms_di_extra.metadata.driver.annotation_driver.class%" public="false">
            <argument type="service" id="annotation_reader" />
        </service>
        <service id="jms_di_extra.metadata_driver" alias="jms_di_extra.metadata.driver.annotation_driver" public="false" />

        <!-- Metadata Factory -->
        <service id="jms_di_extra.metadata.cache.file_cache" class="%jms_di_extra.metadata.cache.file_cache.class%" public="false">
            <argument /><!-- Directory -->
        </service>
        <service id="jms_di_extra.metadata.cache" alias="jms_di_extra.metadata.cache.file_cache" public="false" />
        <service id="jms_di_extra.metadata.metadata_factory" class="%jms_di_extra.metadata.metadata_factory.class%">
            <argument type="service" id="jms_di_extra.metadata_driver" />
            <argument>Metadata\ClassHierarchyMetadata</argument>
            <argument>%kernel.debug%</argument>
            <call method="setCache">
                <argument type="service" id="jms_di_extra.metadata.cache" on-invalid="ignore" />
            </call>
        </service>
        
        <service id="jms_di_extra.metadata.converter" class="%jms_di_extra.metadata.converter.class%" />
        
        <service id="jms_di_extra.controller_resolver" class="%jms_di_extra.controller_resolver.class%" public="false">
            <tag name="monolog.logger" channel="request" />
            <argument type="service" id="service_container" />
            <argument type="service" id="controller_name_converter" />
            <argument type="service" id="logger" on-invalid="ignore" />
        </service>
    </services>
</container>