<?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">
    <imports>
        <import resource="services/checkers.xml" />
        <import resource="services/form.xml" />
        <import resource="services/listeners.xml" />
    </imports>

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

        <service id="sylius.custom_factory.zone" class="Sylius\Component\Addressing\Factory\ZoneFactory" decorates="sylius.factory.zone" decoration-priority="256" public="false">
            <argument type="service" id="sylius.custom_factory.zone.inner" />
            <argument type="service" id="sylius.factory.zone_member" />
        </service>
        <service id="Sylius\Component\Addressing\Factory\ZoneFactoryInterface" alias="sylius.custom_factory.zone" />

        <service id="sylius.province_naming_provider" class="Sylius\Component\Addressing\Provider\ProvinceNamingProvider" lazy="true">
            <argument type="service" id="sylius.repository.province" />
        </service>
        <service id="Sylius\Component\Addressing\Provider\ProvinceNamingProviderInterface" alias="sylius.province_naming_provider" />

        <service id="sylius.zone_matcher" class="Sylius\Component\Addressing\Matcher\ZoneMatcher">
            <argument type="service" id="sylius.repository.zone" />
        </service>
        <service id="Sylius\Component\Addressing\Matcher\ZoneMatcherInterface" alias="sylius.zone_matcher" />

        <service id="sylius.converter.country_name" class="Sylius\Component\Addressing\Converter\CountryNameConverter" />
        <service id="Sylius\Component\Addressing\Converter\CountryNameConverterInterface" alias="sylius.converter.country_name" />

        <service id="sylius.address_comparator" class="Sylius\Component\Addressing\Comparator\AddressComparator"/>
        <service id="Sylius\Component\Addressing\Comparator\AddressComparatorInterface" alias="sylius.address_comparator" />

        <service id="sylius.twig.extension.country_name" class="Sylius\Bundle\AddressingBundle\Twig\CountryNameExtension">
            <argument type="string" id="isoCode" />
            <tag name="twig.extension"/>
        </service>
        <service id="sylius.twig.extension.province_naming" class="Sylius\Bundle\AddressingBundle\Twig\ProvinceNamingExtension">
            <argument type="service" id="sylius.province_naming_provider" />
            <argument type="string" id="provinceCode" />
            <tag name="twig.extension" />
        </service>

        <service id="sylius.validator.valid_province_address" class="Sylius\Bundle\AddressingBundle\Validator\Constraints\ProvinceAddressConstraintValidator">
            <argument type="service" id="sylius.repository.country" />
            <argument type="service" id="sylius.repository.province" />
            <tag name="validator.constraint_validator" alias="sylius_province_address_validator" />
        </service>

        <service id="sylius.validator.zone_cannot_contain_itself" class="Sylius\Bundle\AddressingBundle\Validator\Constraints\ZoneCannotContainItselfValidator">
            <tag name="validator.constraint_validator" alias="sylius_zone_cannot_contain_itself_validator" />
        </service>

        <service id="sylius.validator.unique_province_collection" class="Sylius\Bundle\AddressingBundle\Validator\Constraints\UniqueProvinceCollectionValidator">
            <tag name="validator.constraint_validator" alias="sylius_unique_province_collection_validator" />
        </service>
    </services>
</container>
