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

<!--
    ~ This file is part of the Sylius package.
    ~
    ~ (c) Sylius Sp. z o.o.
    ~
    ~ For the full copyright and license information, please view the LICENSE
    ~ file that was distributed with this source code.
    -->

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

        <service id="sylius_abstraction.state_machine.composite" class="Sylius\Abstraction\StateMachine\CompositeStateMachine">
            <argument type="tagged_iterator" tag="sylius.state_machine" index-by="key" />
            <argument>%sylius_abstraction.state_machine.default_adapter%</argument>
            <argument>%sylius_abstraction.state_machine.graphs_to_adapters_mapping%</argument>
        </service>
        <service id="Sylius\Abstraction\StateMachine\StateMachineInterface $compositeStateMachine" alias="sylius_abstraction.state_machine.composite" />

        <service id="sylius_abstraction.state_machine" alias="sylius_abstraction.state_machine.composite" />
        <service id="Sylius\Abstraction\StateMachine\StateMachineInterface" alias="sylius_abstraction.state_machine" />

        <service id="sylius_abstraction.state_machine.adapter.symfony_workflow" class="Sylius\Abstraction\StateMachine\SymfonyWorkflowAdapter">
            <argument type="service" id="workflow.registry" />
            <tag name="sylius.state_machine" key="symfony_workflow" />
        </service>
        <service id="Sylius\Abstraction\StateMachine\StateMachineInterface $symfonyWorkflow" alias="sylius_abstraction.state_machine.adapter.symfony_workflow" />

        <service id="sylius_abstraction.state_machine.adapter.winzou_state_machine" class="Sylius\Abstraction\StateMachine\WinzouStateMachineAdapter">
            <argument type="service" id="sm.factory" />
            <tag name="sylius.state_machine" key="winzou_state_machine" />
        </service>
        <service id="Sylius\Abstraction\StateMachine\StateMachineInterface $winzouStateMachine" alias="sylius_abstraction.state_machine.adapter.winzou_state_machine" />

        <service id="sylius_abstraction.twig.extension.state_machine" class="Sylius\Abstraction\StateMachine\Twig\StateMachineExtension">
            <argument type="service" id="sylius_abstraction.state_machine" />
            <tag name="twig.extension" />
        </service>
    </services>
</container>
