<?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\Promotion\Model\Promotion">
        <constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
            <option name="fields">code</option>
            <option name="message">sylius.promotion.code.unique</option>
            <option name="groups">sylius</option>
        </constraint>
        <constraint name="Sylius\Bundle\PromotionBundle\Validator\Constraints\PromotionDateRange">
            <option name="message">sylius.promotion.end_date_cannot_be_set_prior_start_date</option>
            <option name="groups">sylius</option>
        </constraint>
        <property name="code">
            <constraint name="NotBlank">
                <option name="message">sylius.promotion.code.not_blank</option>
                <option name="groups">sylius</option>
            </constraint>
            <constraint name="Regex">
                <option name="message">sylius.promotion.code.regex</option>
                <option name="pattern">/^[\w-]*$/</option>
                <option name="groups">sylius</option>
            </constraint>
            <constraint name="Length">
                <option name="max">255</option>
                <option name="maxMessage">sylius.promotion.code.max_length</option>
                <option name="groups">sylius</option>
            </constraint>
        </property>
        <property name="name">
            <constraint name="NotBlank">
                <option name="message">sylius.promotion.name.not_blank</option>
                <option name="groups">sylius</option>
            </constraint>
            <constraint name="Length">
                <option name="min">2</option>
                <option name="max">255</option>
                <option name="minMessage">sylius.promotion.name.min_length</option>
                <option name="maxMessage">sylius.promotion.name.max_length</option>
                <option name="groups">sylius</option>
            </constraint>
        </property>
        <property name="description">
            <constraint name="Length">
                <option name="min">2</option>
                <option name="max">255</option>
                <option name="minMessage">sylius.promotion.description.min_length</option>
                <option name="maxMessage">sylius.promotion.description.max_length</option>
                <option name="groups">sylius</option>
            </constraint>
        </property>
        <property name="actions">
            <constraint name="Valid" />
        </property>
        <property name="rules">
            <constraint name="Valid" />
        </property>
        <property name="translations">
            <constraint name="Valid" />
        </property>
    </class>
</constraint-mapping>
