<?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="fos_elastica.property_accessor.magicCall">0</parameter>
        <parameter key="fos_elastica.property_accessor.throwExceptionOnInvalidIndex">0</parameter>
    </parameters>

    <services>
        <service id="fos_elastica.client_prototype" class="FOS\ElasticaBundle\Elastica\Client" abstract="true">
            <argument type="collection" /> <!-- configuration -->
            <argument /> <!-- callback -->

            <call method="setStopwatch">
                <argument type="service" id="debug.stopwatch" on-invalid="null" />
            </call>
        </service>

        <service id="fos_elastica.config_manager" class="FOS\ElasticaBundle\Configuration\ConfigManager">
            <argument type="collection" /> <!-- collection of SourceInterface services -->
        </service>
        <service id="FOS\ElasticaBundle\Configuration\ConfigManager" alias="fos_elastica.config_manager" />

        <service id="fos_elastica.config_manager.index_templates" class="FOS\ElasticaBundle\Configuration\ConfigManager">
            <argument type="collection" /> <!-- collection of SourceInterface services -->
        </service>

        <service id="fos_elastica.data_collector" class="FOS\ElasticaBundle\DataCollector\ElasticaDataCollector">
            <tag name="data_collector" template="@FOSElastica/Collector/elastica.html.twig" id="elastica" />
            <argument type="service" id="fos_elastica.logger" />
        </service>

        <service id="fos_elastica.paginator.subscriber" class="FOS\ElasticaBundle\Subscriber\PaginateElasticaQuerySubscriber">
            <tag name="kernel.event_subscriber" />
            <argument type="service" id="request_stack" />
        </service>

        <service id="fos_elastica.logger" class="FOS\ElasticaBundle\Logger\ElasticaLogger">
            <argument type="service" id="logger" on-invalid="null" />
            <argument>%kernel.debug%</argument>
            <tag name="monolog.logger" channel="elastica" />
        </service>

        <service id="fos_elastica.mapping_builder" class="FOS\ElasticaBundle\Index\MappingBuilder">
            <argument type="service" id="event_dispatcher" />
        </service>

        <service id="fos_elastica.property_accessor" class="Symfony\Component\PropertyAccess\PropertyAccessor">
            <argument>%fos_elastica.property_accessor.magicCall%</argument>
            <argument>%fos_elastica.property_accessor.throwExceptionOnInvalidIndex%</argument>
        </service>
    </services>
</container>
