<?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.catalog_promotion.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.catalog_promotion_translation.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion_translation.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion_action.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion_scope.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion_coupon.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
        <parameter key="sylius.form.type.promotion_coupon_generator_instruction.validation_groups" type="collection">
            <parameter>sylius</parameter>
        </parameter>
    </parameters>

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

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionType">
            <argument>%sylius.model.catalog_promotion.class%</argument>
            <argument>%sylius.form.type.catalog_promotion.validation_groups%</argument>
            <argument>Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionTranslationType</argument>
            <tag name="form.type" />
        </service>

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionScopeType">
            <argument>%sylius.model.catalog_promotion_scope.class%</argument>
            <argument>%sylius.form.type.catalog_promotion.validation_groups%</argument>
            <argument type="collection"/>
            <tag name="form.type" />
        </service>

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionAction\PercentageDiscountActionConfigurationType">
            <tag name="sylius.catalog_promotion.action_configuration_type" key="%sylius.catalog_promotion.action.percentage_discount%" />
            <tag name="form.type" />
        </service>

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionActionType">
            <argument>%sylius.model.catalog_promotion_action.class%</argument>
            <argument>%sylius.form.type.catalog_promotion.validation_groups%</argument>
            <argument type="tagged_iterator" tag="sylius.catalog_promotion.action_configuration_type" index-by="key" />
            <tag name="form.type" />
        </service>

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionTranslationType">
            <argument>%sylius.model.catalog_promotion_translation.class%</argument>
            <argument>%sylius.form.type.catalog_promotion_translation.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionType">
            <argument>%sylius.model.promotion.class%</argument>
            <argument>%sylius.form.type.promotion.validation_groups%</argument>
            <argument>Sylius\Bundle\PromotionBundle\Form\Type\PromotionTranslationType</argument>
            <tag name="form.type" />
        </service>

        <service id="Sylius\Bundle\PromotionBundle\Form\Type\PromotionTranslationType">
            <argument>%sylius.model.promotion_translation.class%</argument>
            <argument>%sylius.form.type.promotion_translation.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_action" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionActionType">
            <argument>%sylius.model.promotion_action.class%</argument>
            <argument>%sylius.form.type.promotion_action.validation_groups%</argument>
            <argument type="service" id="sylius.form_registry.promotion_action" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_rule" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionRuleType">
            <argument>%sylius.model.promotion_rule.class%</argument>
            <argument>%sylius.form.type.promotion_scope.validation_groups%</argument>
            <argument type="service" id="sylius.form_registry.promotion_rule_checker" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_coupon" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionCouponType">
            <argument>%sylius.model.promotion_coupon.class%</argument>
            <argument>%sylius.form.type.promotion_coupon.validation_groups%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_action.collection" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionActionCollectionType">
            <argument type="service" id="sylius.registry_promotion_action" />
            <tag name="form.type" />
        </service>
        <service id="sylius.form.type.promotion_rule.collection" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionRuleCollectionType">
            <argument type="service" id="sylius.registry_promotion_rule_checker" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_action_choice" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionActionChoiceType">
            <argument>%sylius.promotion_actions%</argument>
            <tag name="form.type" />
        </service>
        <service id="sylius.form.type.promotion_rule_choice" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionRuleChoiceType">
            <argument>%sylius.promotion_rules%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_coupon_to_code" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionCouponToCodeType">
            <argument type="service" id="sylius.repository.promotion_coupon" />
            <tag name="form.type" />
        </service>

        <service id="sylius.form.type.promotion_coupon_generator_instruction" class="Sylius\Bundle\PromotionBundle\Form\Type\PromotionCouponGeneratorInstructionType">
            <argument type="service">
                <service class="\Symfony\Component\Form\Extension\Core\DataMapper\DataMapper" />
            </argument>
            <argument type="service" id="sylius.factory.promotion_coupon_generator_instruction" />
            <argument>Sylius\Component\Promotion\Generator\PromotionCouponGeneratorInstruction</argument>
            <argument>%sylius.form.type.promotion_coupon_generator_instruction.validation_groups%</argument>
            <tag name="form.type" />
        </service>

    </services>
</container>
