<?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">
    <services>
        <defaults public="true" />

        <service id="sylius.custom_factory.promotion_action" class="Sylius\Component\Core\Factory\PromotionActionFactory" decorates="sylius.factory.promotion_action" decoration-priority="256" public="false">
            <argument type="service" id="sylius.custom_factory.promotion_action.inner" />
        </service>
        <service id="Sylius\Component\Core\Factory\PromotionActionFactoryInterface" alias="sylius.custom_factory.promotion_action" />

        <service id="sylius.custom_factory.promotion_rule" class="Sylius\Component\Core\Factory\PromotionRuleFactory" decorates="sylius.factory.promotion_rule" decoration-priority="256" public="false">
            <argument type="service" id="sylius.custom_factory.promotion_rule.inner" />
        </service>
        <service id="Sylius\Component\Core\Factory\PromotionRuleFactoryInterface" alias="sylius.custom_factory.promotion_rule" />

        <service id="sylius.active_promotions_provider" class="Sylius\Component\Core\Provider\ActivePromotionsByChannelProvider">
            <argument type="service" id="sylius.repository.promotion" />
        </service>

        <service id="sylius.promotion_rule_checker.customer_group" class="Sylius\Component\Core\Promotion\Checker\Rule\CustomerGroupRuleChecker" public="false">
            <tag name="sylius.promotion_rule_checker" type="customer_group" label="sylius.form.promotion_rule.customer_group" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\CustomerGroupConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.nth_order" class="Sylius\Component\Core\Promotion\Checker\Rule\NthOrderRuleChecker">
            <argument type="service" id="sylius.repository.order" />
            <tag name="sylius.promotion_rule_checker" type="nth_order" label="sylius.form.promotion_rule.nth_order" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\NthOrderConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.shipping_country" class="Sylius\Component\Core\Promotion\Checker\Rule\ShippingCountryRuleChecker">
            <argument type="service" id="sylius.repository.country" />
            <tag name="sylius.promotion_rule_checker" type="shipping_country" label="sylius.form.promotion_rule.shipping_country" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\ShippingCountryConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.has_taxon" class="Sylius\Component\Core\Promotion\Checker\Rule\HasTaxonRuleChecker">
            <tag name="sylius.promotion_rule_checker" type="has_taxon" label="sylius.form.promotion_rule.has_at_least_one_from_taxons" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\HasTaxonConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.total_of_items_from_taxon" class="Sylius\Component\Core\Promotion\Checker\Rule\TotalOfItemsFromTaxonRuleChecker">
            <argument type="service" id="sylius.repository.taxon" />
            <tag name="sylius.promotion_rule_checker" type="total_of_items_from_taxon" label="sylius.form.promotion_rule.total_price_of_items_from_taxon" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\ChannelBasedTotalOfItemsFromTaxonConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.contains_product" class="Sylius\Component\Core\Promotion\Checker\Rule\ContainsProductRuleChecker">
            <tag name="sylius.promotion_rule_checker" type="contains_product" label="sylius.form.promotion_rule.contains_product" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\ContainsProductConfigurationType" />
        </service>
        <service id="sylius.promotion_rule_checker.item_total" class="Sylius\Component\Core\Promotion\Checker\Rule\ItemTotalRuleChecker">
            <tag name="sylius.promotion_rule_checker" type="item_total" label="sylius.form.promotion_rule.item_total" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule\ChannelBasedItemTotalConfigurationType" />
        </service>
        <service id="sylius.channel_aware_promotion_rule_checker.item_total" alias="sylius.promotion_rule_checker.item_total">
            <deprecated package="sylius/core-bundle" version="1.13">The "%service_id%" service is deprecated since 1.13 and will be removed in 2.0. Use "%alias_id%" instead</deprecated>
        </service>
        <service id="sylius.promotion_rule_checker.cart_quantity" class="Sylius\Component\Core\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" />
        </service>

        <service id="sylius.promotion_action.fixed_discount" class="Sylius\Component\Core\Promotion\Action\FixedDiscountPromotionActionCommand">
            <argument type="service" id="sylius.proportional_integer_distributor" />
            <argument type="service" id="sylius.promotion.units_promotion_adjustments_applicator" />
            <argument type="service" id="Sylius\Component\Core\Distributor\MinimumPriceDistributorInterface" />
            <argument type="service" id="sylius.currency_converter" />
            <tag name="sylius.promotion_action" type="order_fixed_discount" label="sylius.form.promotion_action.order_fixed_discount" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Action\ChannelBasedFixedDiscountConfigurationType" />
        </service>
        <service id="sylius.promotion_action.unit_fixed_discount" class="Sylius\Component\Core\Promotion\Action\UnitFixedDiscountPromotionActionCommand">
            <argument type="service" id="sylius.factory.adjustment" />
            <argument type="service" id="sylius.promotion_filter.price_range" />
            <argument type="service" id="sylius.promotion_filter.taxon" />
            <argument type="service" id="sylius.promotion_filter.product" />
            <argument type="service" id="sylius.currency_converter" />
            <tag name="sylius.promotion_action" type="unit_fixed_discount" label="sylius.form.promotion_action.item_fixed_discount" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Action\ChannelBasedUnitFixedDiscountConfigurationType" />
        </service>
        <service id="sylius.promotion_action.percentage_discount" class="Sylius\Component\Core\Promotion\Action\PercentageDiscountPromotionActionCommand">
            <argument type="service" id="sylius.proportional_integer_distributor" />
            <argument type="service" id="sylius.promotion.units_promotion_adjustments_applicator" />
            <argument type="service" id="Sylius\Component\Core\Distributor\MinimumPriceDistributorInterface" />
            <tag name="sylius.promotion_action" type="order_percentage_discount" label="sylius.form.promotion_action.order_percentage_discount" form-type="Sylius\Bundle\PromotionBundle\Form\Type\Action\PercentageDiscountConfigurationType" />
        </service>
        <service id="sylius.promotion_action.unit_percentage_discount" class="Sylius\Component\Core\Promotion\Action\UnitPercentageDiscountPromotionActionCommand">
            <argument type="service" id="sylius.factory.adjustment" />
            <argument type="service" id="sylius.promotion_filter.price_range" />
            <argument type="service" id="sylius.promotion_filter.taxon" />
            <argument type="service" id="sylius.promotion_filter.product" />
            <tag name="sylius.promotion_action" type="unit_percentage_discount" label="sylius.form.promotion_action.item_percentage_discount" form-type="Sylius\Bundle\CoreBundle\Form\Type\Promotion\Action\ChannelBasedUnitPercentageDiscountConfigurationType" />
        </service>
        <service id="sylius.promotion_action.shipping_percentage_discount" class="Sylius\Component\Core\Promotion\Action\ShippingPercentageDiscountPromotionActionCommand">
            <argument type="service" id="sylius.factory.adjustment" />
            <tag name="sylius.promotion_action" type="shipping_percentage_discount" label="sylius.form.promotion_action.shipping_percentage_discount" form-type="Sylius\Bundle\PromotionBundle\Form\Type\Action\PercentageDiscountConfigurationType" />
        </service>

        <service id="sylius.promotion.eligibility_checker.promotion_coupon_per_customer_usage_limit"
                 class="Sylius\Component\Core\Promotion\Checker\Eligibility\PromotionCouponPerCustomerUsageLimitEligibilityChecker"
                 public="false">
            <argument type="service" id="sylius.repository.order" />
            <tag name="sylius.promotion_coupon_eligibility_checker" />
        </service>

        <service id="sylius.promotion_filter.taxon" class="Sylius\Component\Core\Promotion\Filter\TaxonFilter" />
        <service id="sylius.promotion_filter.product" class="Sylius\Component\Core\Promotion\Filter\ProductFilter" />
        <service id="sylius.promotion_filter.price_range" class="Sylius\Component\Core\Promotion\Filter\PriceRangeFilter">
            <argument type="service" id="sylius.calculator.product_variant_price" />
        </service>

        <service id="sylius.promotion.units_promotion_adjustments_applicator" class="Sylius\Component\Core\Promotion\Applicator\UnitsPromotionAdjustmentsApplicator">
            <argument type="service" id="sylius.factory.adjustment" />
            <argument type="service" id="sylius.integer_distributor" />
        </service>
        <service id="Sylius\Component\Core\Promotion\Applicator\UnitsPromotionAdjustmentsApplicatorInterface" alias="sylius.promotion.units_promotion_adjustments_applicator" />

        <service id="sylius.promotion_usage_modifier" class="Sylius\Component\Core\Promotion\Modifier\OrderPromotionsUsageModifier">
            <argument type="service" id="sylius.manager.promotion" />
        </service>

        <service id="Sylius\Component\Core\Promotion\Modifier\OrderPromotionsUsageModifierInterface" alias="sylius.promotion_usage_modifier" />

        <service id="sylius.promotion_rule_updater.has_taxon" class="Sylius\Component\Core\Promotion\Updater\Rule\HasTaxonRuleUpdater">
            <argument type="service" id="sylius.repository.promotion_rule" />
            <argument type="service" id="doctrine.orm.entity_manager" />
        </service>

        <service id="sylius.promotion_rule_updater.total_of_items_from_taxon" class="Sylius\Component\Core\Promotion\Updater\Rule\TotalOfItemsFromTaxonRuleUpdater">
            <argument type="service" id="sylius.repository.promotion_rule" />
        </service>

        <service id="Sylius\Component\Core\Promotion\Updater\Rule\ContainsProductRuleUpdater">
            <argument type="service" id="sylius.repository.promotion_rule" />
        </service>

        <service id="Sylius\Component\Core\Promotion\Checker\ProductInPromotionRuleCheckerInterface" class="Sylius\Component\Core\Promotion\Checker\ProductInPromotionRuleChecker">
            <argument type="service" id="sylius.repository.promotion_rule" />
        </service>

        <service id="Sylius\Component\Core\Promotion\Checker\TaxonInPromotionRuleCheckerInterface" class="Sylius\Component\Core\Promotion\Checker\TaxonInPromotionRuleChecker">
            <argument type="service" id="sylius.repository.promotion_rule" />
        </service>
    </services>
</container>
