<?xml version="1.0" ?>
<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="FOS\UserBundle\Model\User">

        <constraint name="FOS\UserBundle\Validator\Unique">
            <option name="property">usernameCanonical</option>
            <option name="message">The username is already used</option>
            <option name="groups">
                <value>Registration</value>
                <value>Profile</value>
            </option>
        </constraint>

        <constraint name="FOS\UserBundle\Validator\Unique">
            <option name="property">emailCanonical</option>
            <option name="message">The email is already used</option>
            <option name="groups">
                <value>Registration</value>
                <value>Profile</value>
            </option>
        </constraint>

        <property name="username">
            <constraint name="NotBlank">
                <option name="message">Please enter a username</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">6</option>
                <option name="message">The username is too short</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
            <constraint name="MaxLength">
                <option name="limit">32</option>
                <option name="message">The username is too long</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
        </property>

        <property name="email">
            <constraint name="NotBlank">
                <option name="message">Please enter an email</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">2</option>
                <option name="message">The email is too short</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
            <constraint name="MaxLength">
                <option name="limit">255</option>
                <option name="message">The email is too long</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
            <constraint name="Email">
                <option name="message">The email is not valid</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
        </property>

        <property name="plainPassword">
            <constraint name="NotBlank">
                <option name="message">Please enter a password</option>
                <option name="groups">Registration</option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">2</option>
                <option name="message">The password is too short</option>
                <option name="groups">
                    <value>Registration</value>
                    <value>Profile</value>
                </option>
            </constraint>
        </property>
    </class>

    <class name="FOS\UserBundle\Form\Model\CheckPassword">
        <constraint name="FOS\UserBundle\Validator\Password">
            <option name="passwordProperty">current</option>
            <option name="userProperty">user</option>
            <option name="groups">
                <value>ChangePassword</value>
                <value>Profile</value>
            </option>
        </constraint>
    </class>

    <class name="FOS\UserBundle\Form\Model\ChangePassword">
        <property name="new">
            <constraint name="NotBlank">
                <option name="message">Please enter a new password</option>
                <option name="groups">ChangePassword</option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">2</option>
                <option name="message">The new password is too short</option>
                <option name="groups">ChangePassword</option>
            </constraint>
        </property>
    </class>

    <class name="FOS\UserBundle\Form\Model\ResetPassword">
        <property name="new">
            <constraint name="NotBlank">
                <option name="message">Please enter a new password</option>
                <option name="groups">ResetPassword</option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">2</option>
                <option name="message">The new password is too short</option>
                <option name="groups">ResetPassword</option>
            </constraint>
        </property>
    </class>

    <class name="FOS\UserBundle\Model\Group">
        <property name="name">
            <constraint name="NotBlank">
                <option name="message">Please enter a name</option>
                <option name="groups">Registration</option>
            </constraint>
            <constraint name="MinLength">
                <option name="limit">2</option>
                <option name="message">The name is too short</option>
                <option name="groups">Registration</option>
            </constraint>
            <constraint name="MaxLength">
                <option name="limit">255</option>
                <option name="message">The name is too long</option>
                <option name="groups">Registration</option>
            </constraint>
        </property>
    </class>

</constraint-mapping>
