<?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\Bundle\ApiBundle\Serializer\AddressDenormalizer">
            <argument type="service" id="serializer.normalizer.object" />
            <argument type="string">%sylius.model.address.class%</argument>
            <argument type="string">%sylius.model.address.interface%</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\CommandArgumentsDenormalizer">
            <argument type="service" id="Sylius\Bundle\ApiBundle\Serializer\CommandDenormalizer" />
            <argument type="service" id="Sylius\Bundle\ApiBundle\Converter\IriToIdentifierConverterInterface" />
            <argument type="service" id="sylius.api.data_transformer.command_aware_input_data_transformer" />
            <tag name="serializer.normalizer" priority="128" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\CommandDenormalizer">
            <argument type="service" id="api_platform.serializer.normalizer.item" />
            <argument type="service" id="api_platform.name_converter" />
            <tag name="serializer.normalizer" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\HydraErrorNormalizer" decorates="api_platform.hydra.normalizer.error">
            <argument type="service" id="Sylius\Bundle\ApiBundle\Serializer\HydraErrorNormalizer.inner" />
            <argument type="service" id="request_stack" />
            <argument>%sylius.security.new_api_route%</argument>
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductNormalizer">
            <argument type="service" id="Sylius\Component\Product\Resolver\ProductVariantResolverInterface" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductAttributeValueDenormalizer">
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductDenormalizer">
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductAttributeValueNormalizer">
            <argument type="service" id="sylius.locale_provider.channel_based" />
            <argument>%locale%</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ImageNormalizer">
            <argument type="service" id="liip_imagine.cache.manager" />
            <argument type="service" id="request_stack" />
            <argument type="string">%sylius_api.default_image_filter%</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\CommandNormalizer">
            <argument type="service" id="serializer.normalizer.object" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductVariantNormalizer">
            <argument type="service" id="sylius.calculator.product_variant_price" />
            <argument type="service" id="sylius.availability_checker" />
            <argument type="service" id="sylius.section_resolver.uri_based_section_resolver" />
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\FlattenExceptionNormalizer" decorates="fos_rest.serializer.flatten_exception_normalizer">
            <argument type="service" id="Sylius\Bundle\ApiBundle\Serializer\FlattenExceptionNormalizer.inner" />
            <argument type="service" id="request_stack" />
            <argument>%sylius.security.new_api_route%</argument>
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ShippingMethodNormalizer">
            <argument type="service" id="sylius.repository.order" />
            <argument type="service" id="sylius.repository.shipment" />
            <argument type="service" id="sylius.registry.shipping_calculator" />
            <argument type="service" id="Symfony\Component\HttpFoundation\RequestStack" />
            <argument type="service" id="Sylius\Component\Channel\Context\ChannelContextInterface" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ZoneDenormalizer">
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\TranslatableDenormalizer">
            <argument type="service" id="sylius.translation_locale_provider" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="date_time_normalizer" class="Symfony\Component\Serializer\Normalizer\DateTimeNormalizer">
            <argument type="collection">
                <argument key="datetime_format">Y-m-d H:i:s</argument>
            </argument>
            <tag name="serializer.normalizer"/>
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ChannelPriceHistoryConfigDenormalizer">
            <argument type="service" id="api_platform.symfony.iri_converter" />
            <argument type="service" id="sylius.factory.channel_price_history_config" />
            <argument type="service" id="Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface" />
            <argument>%sylius.form.type.channel_price_history_config.validation_groups%</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ChannelDenormalizer">
            <argument type="service" id="sylius.factory.channel_price_history_config" />
            <argument type="service" id="sylius.factory.shop_billing_data" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="sylius.api.denormalizer.numeric_to_string.tax_rate" class="Sylius\Bundle\ApiBundle\Serializer\NumericToStringDenormalizer">
            <argument type="string">%sylius.model.tax_rate.class%</argument>
            <argument type="string">amount</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="sylius.api.denormalizer.numeric_to_string.exchange_rate" class="Sylius\Bundle\ApiBundle\Serializer\NumericToStringDenormalizer">
            <argument type="string">%sylius.model.exchange_rate.class%</argument>
            <argument type="string">ratio</argument>
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\CustomerDenormalizer">
            <argument type="service" id="Sylius\Calendar\Provider\DateTimeProviderInterface" />
            <tag name="serializer.normalizer" priority="64" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\TranslatableLocaleKeyDenormalizer">
            <tag name="serializer.normalizer" priority="96" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\ProductVariantChannelPricingsChannelCodeKeyDenormalizer">
            <tag name="serializer.normalizer" priority="96" />
        </service>

        <service id="Sylius\Bundle\ApiBundle\Serializer\DoctrineCollectionValuesNormalizer">
            <tag name="serializer.normalizer" priority="64" />
        </service>
    </services>
</container>
