<?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/form.xml" />
    </imports>

    <parameters>
        <parameter key="sylius.tax_calculator.interface">Sylius\Component\Taxation\Calculator\CalculatorInterface</parameter>
    </parameters>

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

        <service id="sylius.registry.tax_calculator" class="Sylius\Component\Registry\ServiceRegistry">
            <argument>%sylius.tax_calculator.interface%</argument>
            <argument>Tax calculator</argument>
        </service>

        <service id="sylius.tax_calculator" class="Sylius\Component\Taxation\Calculator\DelegatingCalculator">
            <argument type="service" id="sylius.registry.tax_calculator" />
        </service>
        <service id="Sylius\Component\Taxation\Calculator\CalculatorInterface" alias="sylius.tax_calculator" />

        <service id="sylius.tax_calculator.default" class="Sylius\Component\Taxation\Calculator\DefaultCalculator">
            <tag name="sylius.tax_calculator" calculator="default" />
        </service>
        <service id="sylius.tax_calculator.decimal" class="Sylius\Component\Taxation\Calculator\DecimalCalculator">
            <tag name="sylius.tax_calculator" calculator="decimal" />
        </service>

        <service id="sylius.tax_rate_resolver" class="Sylius\Component\Taxation\Resolver\TaxRateResolver">
            <argument type="service" id="sylius.repository.tax_rate" />
            <argument type="service" id="sylius.tax_rate_date_eligibility_checker" on-invalid="null" />
        </service>
        <service id="Sylius\Component\Taxation\Resolver\TaxRateResolverInterface" alias="sylius.tax_rate_resolver" />

        <service id="sylius.tax_rate_date_eligibility_checker" class="Sylius\Component\Taxation\Checker\TaxRateDateEligibilityChecker">
            <argument type="service" id="Sylius\Calendar\Provider\DateTimeProviderInterface" />
        </service>
        <service id="Sylius\Component\Taxation\Checker\TaxRateDateEligibilityCheckerInterface" alias="sylius.tax_rate_date_eligibility_checker" />
    </services>
</container>
