<?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.

-->

<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
    <class name="Sylius\Component\Attribute\Model\Attribute">
        <constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
            <option name="fields">code</option>
            <option name="message">sylius.attribute.code.unique</option>
            <option name="groups">sylius</option>
        </constraint>
        <constraint name="Sylius\Bundle\AttributeBundle\Validator\Constraints\ValidTextAttributeConfiguration">
            <option name="groups">sylius</option>
        </constraint>
        <constraint name="Sylius\Bundle\AttributeBundle\Validator\Constraints\ValidSelectAttributeConfiguration">
            <option name="groups">sylius</option>
        </constraint>
        <constraint name="Sylius\Bundle\AttributeBundle\Validator\Constraints\AttributeType">
            <option name="groups">sylius</option>
        </constraint>
        <property name="code">
            <constraint name="NotBlank">
                <option name="message">sylius.attribute.code.not_blank</option>
                <option name="groups">sylius</option>
            </constraint>
            <constraint name="Length">
                <option name="min">1</option>
                <option name="minMessage">sylius.attribute.code.min_length</option>
                <option name="max">255</option>
                <option name="maxMessage">sylius.attribute.code.max_length</option>
                <option name="groups">sylius</option>
            </constraint>
            <constraint name="Regex">
                <option name="message">sylius.attribute.code.regex</option>
                <option name="pattern">/^[\w-]*$/</option>
                <option name="groups">sylius</option>
            </constraint>
        </property>
        <property name="translations">
            <constraint name="Valid" />
        </property>
    </class>
</constraint-mapping>
