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

    <parameters>
        <parameter key="sylius.model.attribute.interface">Sylius\Component\Attribute\AttributeType\AttributeTypeInterface</parameter>
    </parameters>

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

        <service id="sylius.doctrine.orm.event_subscriber.load_metadata.attribute" class="Sylius\Bundle\AttributeBundle\Doctrine\ORM\Subscriber\LoadMetadataSubscriber">
            <argument>%sylius.attribute.subjects%</argument>
            <tag name="doctrine.event_subscriber" />
        </service>

        <service id="sylius.registry.attribute_type" class="Sylius\Component\Registry\ServiceRegistry">
            <argument>%sylius.model.attribute.interface%</argument>
            <argument>attribute type</argument>
        </service>

        <service id="sylius.form_registry.attribute_type" class="Sylius\Bundle\ResourceBundle\Form\Registry\FormTypeRegistry" />

        <service id="sylius.form.type.attribute_type_choice" class="Sylius\Bundle\AttributeBundle\Form\Type\AttributeTypeChoiceType">
            <argument>%sylius.attribute.attribute_types%</argument>
            <tag name="form.type" />
        </service>

        <service id="sylius.validator.attribute_type" class="Sylius\Bundle\AttributeBundle\Validator\Constraints\AttributeTypeValidator">
            <argument type="service" id="sylius.registry.attribute_type" />
            <tag name="validator.constraint_validator" alias="sylius_attribute_type_validator" />
        </service>

        <service id="sylius.validator.valid_attribute_value" class="Sylius\Bundle\AttributeBundle\Validator\Constraints\ValidAttributeValueValidator">
            <argument type="service" id="sylius.registry.attribute_type" />
            <tag name="validator.constraint_validator" alias="sylius_valid_attribute_value_validator" />
        </service>

        <service id="sylius.validator.valid_text_attribute" class="Sylius\Bundle\AttributeBundle\Validator\Constraints\ValidTextAttributeConfigurationValidator">
            <tag name="validator.constraint_validator" alias="sylius_valid_text_attribute_validator" />
        </service>

        <service id="sylius.validator.valid_select_attribute" class="Sylius\Bundle\AttributeBundle\Validator\Constraints\ValidSelectAttributeConfigurationValidator">
            <tag name="validator.constraint_validator" alias="sylius_valid_select_attribute_validator" />
        </service>
    </services>
</container>
