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

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

        <service id="sylius.custom_factory.promotion_coupon" class="Sylius\Component\Promotion\Factory\PromotionCouponFactory" decorates="sylius.factory.promotion_coupon" decoration-priority="256" public="false">
            <argument type="service" id="sylius.custom_factory.promotion_coupon.inner" />
        </service>
        <service id="Sylius\Component\Promotion\Factory\PromotionCouponFactoryInterface" alias="sylius.factory.promotion_coupon" />

        <service id="sylius.factory.promotion_coupon_generator_instruction" class="Sylius\Component\Promotion\Factory\PromotionCouponGeneratorInstructionFactory" public="false" />
        <service id="Sylius\Component\Promotion\Factory\PromotionCouponGeneratorInstructionFactoryInterface" alias="sylius.factory.promotion_coupon_generator_instruction" />

        <service id="sylius.promotion_processor" class="Sylius\Component\Promotion\Processor\PromotionProcessor">
            <argument type="service" id="sylius.active_promotions_provider" />
            <argument type="service" id="sylius.promotion_eligibility_checker" />
            <argument type="service" id="sylius.promotion_applicator" />
        </service>
        <service id="Sylius\Component\Promotion\Processor\PromotionProcessorInterface" alias="sylius.promotion_processor" />

        <service id="sylius.promotion_rule_checker.cart_quantity" class="Sylius\Component\Promotion\Checker\Rule\CartQuantityRuleChecker">
            <tag name="sylius.promotion_rule_checker" type="cart_quantity" label="sylius.form.promotion_rule.cart_quantity" form-type="Sylius\Bundle\PromotionBundle\Form\Type\Rule\CartQuantityConfigurationType" />
            <deprecated package="sylius/promotion-bundle" version="1.13">The "%service_id%" service is deprecated since 1.13 and will be removed in 2.0.</deprecated>
        </service>

        <service id="sylius.promotion_applicator" class="Sylius\Component\Promotion\Action\PromotionApplicator">
            <argument type="service" id="sylius.registry_promotion_action" />
        </service>
        <service id="Sylius\Component\Promotion\Action\PromotionApplicatorInterface" alias="sylius.promotion_applicator" />

        <service id="sylius.registry_promotion_rule_checker" class="Sylius\Component\Registry\ServiceRegistry">
            <argument>Sylius\Component\Promotion\Checker\Rule\RuleCheckerInterface</argument>
            <argument>rule checker</argument>
        </service>
        <service id="sylius.form_registry.promotion_rule_checker" class="Sylius\Bundle\ResourceBundle\Form\Registry\FormTypeRegistry" />

        <service id="sylius.registry_promotion_action" class="Sylius\Component\Registry\ServiceRegistry">
            <argument>Sylius\Component\Promotion\Action\PromotionActionCommandInterface</argument>
            <argument>promotion action</argument>
        </service>
        <service id="sylius.form_registry.promotion_action" class="Sylius\Bundle\ResourceBundle\Form\Registry\FormTypeRegistry" />

        <service id="sylius.active_promotions_provider" class="Sylius\Component\Promotion\Provider\ActivePromotionsProvider">
            <argument type="service" id="sylius.repository.promotion" />
        </service>
        <service id="Sylius\Component\Promotion\Provider\ActivePromotionsProvider" alias="sylius.active_promotions_provider" />

        <service id="sylius.promotion_coupon_generator" class="Sylius\Component\Promotion\Generator\PromotionCouponGenerator">
            <argument type="service" id="sylius.factory.promotion_coupon" />
            <argument type="service" id="sylius.repository.promotion_coupon" />
            <argument type="service" id="sylius.manager.promotion_coupon" />
            <argument type="service" id="sylius.promotion_coupon_generator.percentage_policy" />
        </service>
        <service id="Sylius\Component\Promotion\Generator\PromotionCouponGeneratorInterface" alias="sylius.promotion_coupon_generator" />

        <service id="sylius.promotion_coupon_generator.percentage_policy" class="Sylius\Component\Promotion\Generator\PercentageGenerationPolicy">
            <argument type="service" id="sylius.repository.promotion_coupon" />
        </service>

        <service
            id="Sylius\Bundle\PromotionBundle\Provider\EligibleCatalogPromotionsProviderInterface"
            class="Sylius\Bundle\PromotionBundle\Provider\EligibleCatalogPromotionsProvider"
        >
            <argument type="service" id="sylius.repository.catalog_promotion" />
            <argument type="tagged_iterator" tag="sylius.catalog_promotion.criteria" />
        </service>
    </services>
</container>
