<?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">
    <services>
        <defaults public="true" />

        <service id="sylius.context.channel.cached" class="Sylius\Component\Channel\Context\CachedPerRequestChannelContext" decorates="sylius.context.channel" decoration-priority="256" public="false">
            <argument type="service" id="sylius.context.channel.cached.inner" />
            <argument type="service" id="request_stack" />
        </service>

        <service id="sylius.theme.context.channel_based" class="Sylius\Bundle\CoreBundle\Theme\ChannelBasedThemeContext" public="false">
            <argument type="service" id="sylius.context.channel" />
            <argument type="service" id="sylius.repository.theme" />
        </service>

        <service id="sylius.context.shopper" class="Sylius\Component\Core\Context\ShopperContext" lazy="true">
            <argument type="service" id="sylius.context.channel" />
            <argument type="service" id="sylius.context.currency" />
            <argument type="service" id="sylius.context.locale" />
            <argument type="service" id="sylius.context.customer" />
        </service>
        <service id="Sylius\Component\Core\Context\ShopperContextInterface" alias="sylius.context.shopper" />

        <service id="sylius.context.cart.new_shop_based" class="Sylius\Component\Core\Cart\Context\ShopBasedCartContext" decorates="sylius.context.cart.new" decoration-priority="256" public="false">
            <argument type="service" id="sylius.context.cart.new_shop_based.inner" />
            <argument type="service" id="sylius.context.shopper" />
            <argument type="service" id="Sylius\Component\Core\Cart\Resolver\CreatedByGuestFlagResolverInterface" />
        </service>
        <service id="sylius.context.cart.customer_and_channel_based" class="Sylius\Bundle\CoreBundle\Context\CustomerAndChannelBasedCartContext">
            <argument type="service" id="sylius.context.customer" />
            <argument type="service" id="sylius.context.channel" />
            <argument type="service" id="sylius.repository.order" />
            <tag name="sylius.context.cart" priority="-555" />
        </service>

        <service id="sylius.storage.currency" class="Sylius\Component\Core\Currency\CurrencyStorage">
            <argument type="service" id="sylius.storage.cookie" />
        </service>
        <service id="Sylius\Component\Core\Currency\CurrencyStorageInterface" alias="sylius.storage.currency" />

        <service id="sylius.context.currency.storage_based" class="Sylius\Component\Core\Currency\Context\StorageBasedCurrencyContext">
            <argument type="service" id="sylius.context.channel" />
            <argument type="service" id="sylius.storage.currency" />
            <tag name="sylius.context.currency" />
        </service>

        <service id="sylius.context.currency.channel_aware" class="Sylius\Component\Core\Currency\Context\ChannelAwareCurrencyContext" decorates="sylius.context.currency" decoration-priority="256">
            <argument type="service" id="sylius.context.currency.channel_aware.inner" />
            <argument type="service" id="sylius.context.channel" />
        </service>

        <service id="sylius.locale_provider.channel_based" class="Sylius\Component\Core\Provider\ChannelBasedLocaleProvider" decorates="sylius.locale_provider" decoration-priority="256">
            <argument type="service" id="sylius.context.channel" />
            <argument>%locale%</argument>
        </service>

        <service id="sylius.context.locale.request_based" class="Sylius\Bundle\LocaleBundle\Context\RequestBasedLocaleContext">
            <argument type="service" id="request_stack" />
            <argument type="service" id="sylius.locale_provider" />
            <tag name="sylius.context.locale" priority="64" />
        </service>

        <service id="sylius.context.locale.provider_based" class="Sylius\Component\Locale\Context\ProviderBasedLocaleContext">
            <argument type="service" id="sylius.locale_provider" />
            <tag name="sylius.context.locale" priority="-128" />
        </service>
    </services>
</container>
