<?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.address.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.country.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.province.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.zone.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.zone_member.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
    </parameters>

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

        <service id="sylius.form.type.address" class="Sylius\Bundle\AddressingBundle\Form\Type\AddressType">
            <argument>%sylius.model.address.class%</argument>
            <argument>%sylius.form.type.address.validation_groups%</argument>
            <argument type="service">
                <service class="Sylius\Bundle\AddressingBundle\Form\EventListener\BuildAddressFormSubscriber">
                    <argument type="service" id="sylius.repository.country" />
                    <argument type="service" id="form.factory" />
                </service>
            </argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.country" class="Sylius\Bundle\AddressingBundle\Form\Type\CountryType">
            <argument>%sylius.model.country.class%</argument>
            <argument>%sylius.form.type.country.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.country_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\CountryChoiceType">
            <argument type="service" id="sylius.repository.country" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.country_code_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\CountryCodeChoiceType">
            <argument type="service" id="sylius.repository.country" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.province" class="Sylius\Bundle\AddressingBundle\Form\Type\ProvinceType">
            <argument>%sylius.model.province.class%</argument>
            <argument>%sylius.form.type.province.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.province_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\ProvinceChoiceType">
            <argument type="service" id="sylius.repository.province" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.province_code_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\ProvinceCodeChoiceType">
            <argument type="service" id="sylius.repository.province" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.zone" class="Sylius\Bundle\AddressingBundle\Form\Type\ZoneType">
            <argument>%sylius.model.zone.class%</argument>
            <argument>%sylius.form.type.zone.validation_groups%</argument>
            <argument>%sylius.scope.zone%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.zone_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\ZoneChoiceType">
            <argument type="service" id="sylius.repository.zone" />
            <argument>%sylius.scope.zone%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.zone_code_choice" class="Sylius\Bundle\AddressingBundle\Form\Type\ZoneCodeChoiceType">
            <argument type="service" id="sylius.repository.zone" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.zone_member" class="Sylius\Bundle\AddressingBundle\Form\Type\ZoneMemberType">
            <argument>%sylius.model.zone_member.class%</argument>
            <argument>%sylius.form.type.zone_member.validation_groups%</argument>
            <tag name="form.type" />
        </service>
    </services>
</container>
