<?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="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="sylius.channel.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>

        <parameter key="sylius.form.type.channel.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
    </parameters>

    <services>
        <defaults public="true" />

        <service id="sylius.custom_factory.channel" class="Sylius\Component\Channel\Factory\ChannelFactory" decorates="sylius.factory.channel" decoration-priority="256" public="false">
            <argument type="service" id="sylius.custom_factory.channel.inner" />
        </service>
        <service id="Sylius\Component\Channel\Factory\ChannelFactoryInterface" alias="sylius.custom_factory.channel" />

        <service id="sylius.form.type.channel" class="Sylius\Bundle\ChannelBundle\Form\Type\ChannelType">
            <argument>%sylius.model.channel.class%</argument>
            <argument>%sylius.form.type.channel.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.channel_choice" class="Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType">
            <argument type="service" id="sylius.repository.channel" />
            <tag name="form.type" />
        </service>

        <service id="sylius.context.channel.composite" class="Sylius\Component\Channel\Context\CompositeChannelContext" public="false" />
        <service id="Sylius\Component\Channel\Context\ChannelContextInterface" alias="sylius.context.channel" />

        <service id="sylius.context.channel.request_based" class="Sylius\Component\Channel\Context\RequestBased\ChannelContext" public="false">
            <argument type="service" id="sylius.context.channel.request_based.resolver" />
            <argument type="service" id="request_stack" />
            <tag name="sylius.context.channel" />
        </service>

        <service id="sylius.context.channel.single_channel" class="Sylius\Component\Channel\Context\SingleChannelContext" public="false">
            <argument type="service" id="sylius.repository.channel" />
            <tag name="sylius.context.channel" priority="-128"/>
        </service>

        <service id="sylius.context.channel.request_based.resolver.composite" class="Sylius\Component\Channel\Context\RequestBased\CompositeRequestResolver" public="false"/>
        <service id="Sylius\Component\Channel\Context\RequestBased\RequestResolverInterface" alias="sylius.context.channel.request_based.resolver.composite" />

        <service id="sylius.context.channel.request_based.resolver.hostname_based" class="Sylius\Component\Channel\Context\RequestBased\HostnameBasedRequestResolver" public="false">
            <argument type="service" id="sylius.repository.channel" />
            <tag name="sylius.context.channel.request_based.resolver" />
        </service>

        <service id="sylius.channel_collector" class="Sylius\Bundle\ChannelBundle\Collector\ChannelCollector" public="false">
            <argument type="service" id="sylius.repository.channel" />
            <argument type="service" id="sylius.context.channel" />
            <argument>false</argument>
            <tag name="data_collector" template="@SyliusChannel/Collector/channel.html.twig" id="sylius.channel_collector" />
        </service>

        <service id="sylius.checker.channel_deletion" class="Sylius\Component\Channel\Checker\ChannelDeletionChecker">
            <argument type="service" id="sylius.repository.channel" />
        </service>
        <service id="Sylius\Component\Channel\Checker\ChannelDeletionCheckerInterface" alias="sylius.checker.channel_deletion" />
    </services>
</container>
