<?xml version="1.0" ?>

<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="prooph_event_store.stream_table_map" type="collection" />
    </parameters>

    <services>
        <service id="prooph_event_store.store_definition" class="Prooph\EventStore\EventStore" abstract="true" public="true">
            <factory service="prooph_event_store.store_factory" method="createEventStore" />
        </service>
        <service id="prooph_event_store.store_factory" class="Prooph\Bundle\EventStore\Factory\DefaultEventStoreFactory" />
        <service id="prooph_event_store.plugin_definition" class="Prooph\EventStore\Plugin\Plugin" abstract="true" />
        <service id="prooph_event_store.metadata_enricher_plugin_definition" class="Prooph\EventStore\Metadata\MetadataEnricherPlugin" abstract="true" />
        <service id="prooph_event_store.metadata_enricher_aggregate_definition" class="Prooph\EventStore\Metadata\MetadataEnricherAggregate" abstract="true" />
        <service id="prooph_event_store.projection_definition" class="Prooph\EventStore\Projection\ProjectionManager" abstract="true" public="true">
            <factory service="prooph_event_store.projection_factory" method="createProjectionManager" />
        </service>
        <service id="prooph_event_store.projection_factory" class="Prooph\Bundle\EventStore\ProjectionManagerFactory"/>
        <service id="prooph_event_store.repository_definition" class="Prooph\EventSourcing\Aggregate\AggregateRepository" abstract="true" public="true">
            <factory service="prooph_event_store.repository_factory" method="create" />
        </service>
        <service id="prooph_event_store.repository_factory" class="Prooph\Bundle\EventStore\RepositoryFactory" />
        <service id="prooph_event_store.action_event_emitter_factory" class="Prooph\Bundle\EventStore\Factory\DefaultActionEventEmitterFactory" />
        <service id="prooph_event_store.action_event_emitter" class="Prooph\Common\Event\ProophActionEventEmitter" />
        <service id="prooph_event_store.message_converter" class="Prooph\Common\Messaging\NoOpMessageConverter" />
        <service id="prooph_event_store.message_factory" class="Prooph\Common\Messaging\FQCNMessageFactory" />
        <service id="Prooph\Common\Messaging\MessageFactory" alias="prooph_event_store.message_factory" />

        <service id="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand" abstract="true">
            <argument type="service" id="prooph_event_store.projection_manager_for_projections_locator" />
            <argument type="service" id="prooph_event_store.projections_locator" />
            <argument type="service" id="prooph_event_store.projection_read_models_locator" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionDeleteCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:delete" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionNamesCommand">
            <argument type="service" id="prooph_event_store.projection_managers_locator" />
            <argument>%prooph_event_store.projection_managers%</argument>
            <tag name="console.command" command="event-store:projection:names" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionResetCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:reset" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionRunCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:run" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionStateCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:state" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionStopCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:stop" />
        </service>

        <service id="Prooph\Bundle\EventStore\Command\ProjectionStreamPositionsCommand"
                 parent="Prooph\Bundle\EventStore\Command\AbstractProjectionCommand">
            <tag name="console.command" command="event-store:projection:positions" />
        </service>
    </services>
</container>
