<?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.form.type.shipping_method.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.shipping_method_translation.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.shipping_method_rule.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.shipping_category.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.shipment.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.shipment_ship.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
    </parameters>

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

        <service id="sylius.form_registry.shipping_calculator" class="Sylius\Bundle\ResourceBundle\Form\Registry\FormTypeRegistry" />

        <service id="sylius.form.type.shipping_method" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodType">
            <argument>%sylius.model.shipping_method.class%</argument>
            <argument>%sylius.form.type.shipping_method.validation_groups%</argument>
            <argument>Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodTranslationType</argument>
            <argument type="service" id="sylius.registry.shipping_calculator" />
            <argument type="service" id="sylius.form_registry.shipping_calculator" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_method_translation" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodTranslationType">
            <argument>%sylius.model.shipping_method_translation.class%</argument>
            <argument>%sylius.form.type.shipping_method_translation.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_method_choice" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodChoiceType">
            <argument type="service" id="sylius.shipping_methods_resolver" />
            <argument type="service" id="sylius.registry.shipping_calculator" />
            <argument type="service" id="sylius.repository.shipping_method" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_method_rule" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodRuleType">
            <argument>%sylius.model.shipping_method_rule.class%</argument>
            <argument>%sylius.form.type.shipping_method_rule.validation_groups%</argument>
            <argument type="service" id="sylius.form_registry.shipping_method_rule_checker" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_method_rule.collection" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodRuleCollectionType">
            <argument type="service" id="sylius.registry.shipping_method_rule_checker" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_method_rule_choice" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodRuleChoiceType">
            <argument>%sylius.shipping_method_rules%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_category" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingCategoryType">
            <argument>%sylius.model.shipping_category.class%</argument>
            <argument>%sylius.form.type.shipping_category.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_category_choice" class="Sylius\Bundle\ShippingBundle\Form\Type\ShippingCategoryChoiceType">
            <argument type="service" id="sylius.repository.shipping_category" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipment" class="Sylius\Bundle\ShippingBundle\Form\Type\ShipmentType">
            <argument>%sylius.model.shipment.class%</argument>
            <argument>%sylius.form.type.shipment.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipment_ship" class="Sylius\Bundle\ShippingBundle\Form\Type\ShipmentShipType">
            <argument>%sylius.model.shipment.class%</argument>
            <argument>%sylius.form.type.shipment_ship.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.shipping_calculator_choice" class="Sylius\Bundle\ShippingBundle\Form\Type\CalculatorChoiceType">
            <argument>%sylius.shipping_calculators%</argument>
            <tag name="form.type" />
        </service>
    </services>
</container>
