Sso\WebserviceBundle\Entity\Webservice\Type\Application:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - Application_Add
                - Application_Update
            fields: Id
            message: "a00##Invalid application-id##Application-id already in use."
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - Application_Add
                - Application_Update
            fields: Lowername
            message: "a10##Invalid application-name##Application-name already in use."
            errorPath: Name
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - Application_Add
                message: "a00##Invalid application-id##Application-id should not be empty."
            - Length:
                groups:
                    - Default
                    - Application_Add
                min: 64
                max: 64
                exactMessage: "a01##Invalid application-id##Application-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - Application_Add
                    - Application_Show
                    - Application_Update
                    - Application_Delete
                    - ApplicationRole_Add
                    - ApplicationAttribute_Add
                    - UserApplication_Add
                    - UserApplication_Delete
                    - UserApplicationAttribute_Delete
                    - UserApplicationAttribute_Set
                    - UserApplicationAttribute_Show
                    - UserApplicationRole_Delete
                    - UserApplicationRole_Add
                    - UserApplicationRole_Show
                    - UserSearch_FindByRole
                    - UserSearch_FindByAttribute
                    - UserSearch_FindByApplication
                message: "a10##Invalid application-name##Application-name should not be empty."
            - Length:
                groups:
                    - Default
                    - Application_Add
                    - Application_Show
                    - Application_Update
                    - Application_Delete
                    - ApplicationRole_Add
                    - ApplicationAttribute_Add
                    - UserApplication_Add
                    - UserApplication_Delete
                    - UserApplicationAttribute_Delete
                    - UserApplicationAttribute_Set
                    - UserApplicationAttribute_Show
                    - UserApplicationRole_Delete
                    - UserApplicationRole_Add
                    - UserApplicationRole_Show
                    - UserSearch_FindByRole
                    - UserSearch_FindByAttribute
                    - UserSearch_FindByApplication
                max: 127
                maxMessage: "a11##Invalid application-name##Application-name cannot be longer than 127 characters."
        Description:
            - Length:
                groups:
                    - Default
                    - Application_Add
                max: 255
                maxMessage: "a20##Invalid application-description##Application-description cannot be longer than 255 characters."
        Roles:
            - Count:
                groups:
                    - Application_Delete
                min: 0
                max: 0
                exactMessage: "a30##Roles dependencies##There are role dependencies. Delete roles first."
        Attributes:
            - Count:
                groups:
                    - Application_Delete
                min: 0
                max: 0
                exactMessage: "a40##Attribute dependencies##There are attribute dependencies. Delete attributes first."
        UserApplications:
            - Count:
                groups:
                    - Application_Delete
                min: 0
                max: 0
                exactMessage: "a50##User dependencies##There are users linked to application. Delete links first."


Sso\WebserviceBundle\Entity\Webservice\Type\Attribute:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - ApplicationAttribute_Add
                - ApplicationAttribute_Update
            fields: Id
            message: "u00##Invalid attribute-id##Attribute-id already in use."
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - ApplicationAttribute_Add
                - ApplicationAttribute_Update
            fields: [Id,Application]
            errorPath: Id
            message: "u00##Invalid attribute-id##Attribute-id already in use."
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - ApplicationAttribute_Add
                message: "at00##Invalid attribute-id##Attribute-id should not be empty."
            - Length:
                groups:
                    - Default
                    - ApplicationAttribute_Add
                min: 64
                max: 64
                exactMessage: "at01##Invalid attribute-id##Attribute-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - ApplicationAttribute_Add
                    - ApplicationAttribute_Delete
                    - UserApplicationAttribute_Set
                message: "at10##Invalid attribute-name##Attribute-name should not be empty."
            - Length:
                groups:
                    - Default
                    - ApplicationAttribute_Add
                    - ApplicationAttribute_Delete
                    - UserApplicationAttribute_Set
                max: 64
                maxMessage: "at11##Invalid attribute-name##Attribute-name cannot be longer than 64 characters."
        Type:
            - Choice:
                groups:
                    - Default
                    - ApplicationAttribute_Add
                    - UserApplicationAttribute_Set
                choices: ["one","many"]
                message: "at20##Invalid attribute-type##Attribute-type must be 'one' or 'many'."
        Application:
            - NotBlank:
                groups:
                    Default
                message: "at30##Missing application##Attribute must be linked to an application!"


Sso\WebserviceBundle\Entity\Webservice\Type\UserApplication:
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - UserApplication_Add
                message: "ua00##Invalid id##UserApplication-id should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplication_Add
                min: 64
                max: 64
                exactMessage: "ua01##Invalid id##UserApplication-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - UserApplication_Add
                message: "ua10##Invalid application-name##Application-name should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplication_Add
                max: 127
                maxMessage: "ua11##Invalid application-name##Application-name cannot be longer than 127 characters."
        Active:
            - NotBlank:
                groups:
                    - Default
                    - UserApplication_Add
                    - UserApplication_Show
                    - UserSearch_FindByApplication
                message: "ua60##Invalid active-flag##Active flag should not be empty."
            - Choice:
                groups:
                    - Default
                    - UserApplication_Add
                    - UserApplication_Show
                    - UserSearch_FindByApplication
                choices: ["0","1"]
                message: "ua61##Invalid active-flag##Active flag must be 1 or 0."
        User:
            - NotBlank:
                groups:
                    Default
                message: "ua20##Missing User##Users application must be linked to an user!"
        Application:
            - NotBlank:
                groups:
                    Default
                message: "ua30##Missing Application##Users application value must be linked to an application!"
        Attributes:
            - Count:
                groups:
                    - UserApplication_Delete
                min: 0
                max: 0
                exactMessage: "ua40##Attribute dependencies##There are attribute dependencies. Delete attributes first."
        Roles:
            - Count:
                groups:
                    - UserApplication_Delete
                min: 0
                max: 0
                exactMessage: "ua50##Role dependencies##There are role dependencies. Delete roles first."


Sso\WebserviceBundle\Entity\Webservice\Type\UserApplicationAttribute:
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                message: "uaa00##Invalid id##UserApplicationAttribute-id should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                min: 64
                max: 64
                exactMessage: "uaa01##Invalid id##UserApplicationAttribute-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                    - UserSearch_FindByAttribute
                message: "uaa10##Invalid attribute-name##Attribute-name should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                    - UserSearch_FindByAttribute
                max: 64
                maxMessage: "uaa11##Invalid attribute-name##Attribute-name cannot be longer than 64 characters."
        Type:
            - NotBlank:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                message: "uaa20##Invalid attribute-type##Attribute-type should not be empty."
            - Choice:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                choices: ["one","many"]
                message: "uaa21##Invalid attribute-type##Attribute-type must be 'one' or 'many'."
        Value:
            - Length:
                groups:
                    - Default
                    - UserApplicationAttribute_Set
                    - UserSearch_FindByAttribute
                max: 65535
                maxMessage: "uaa31##Invalid attribute-value##Attribute-value cannot be longer than 65535 (= 2 ^ 16 - 1) characters."
        UserApplication:
            - NotBlank:
                groups:
                    Default
                message: "uaa30##Missing User##Attribute value must be linked to an user!"
        Attribute:
            - NotBlank:
                groups:
                    Default
                message: "uaa40##Missing Attribute##Attribute value must be linked to an attribute!"


Sso\WebserviceBundle\Entity\Webservice\Type\UserApplicationRole:
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - UserApplicationRole_Add
                message: "uar00##Invalid id##UserApplicationRole-id should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplicationRole_Add
                min: 64
                max: 64
                exactMessage: "uar01##Invalid id##UserApplicationRole-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - UserApplicationRole_Add
                    - UserSearch_FindByRole
                message: "uar10##Invalid role-name##Role-name should not be empty."
            - Length:
                groups:
                    - Default
                    - UserApplicationRole_Add
                    - UserSearch_FindByRole
                max: 64
                maxMessage: "uar11##Invalid role-name##Role-name cannot be longer than 64 characters."
        UserApplication:
            - NotBlank:
                groups:
                    Default
                message: "uar20##Missing User##UserRole must be linked to an user!"
        Role:
            - NotBlank:
                groups:
                    Default
                message: "uar30##Missing Role##UserRole value must be linked to an Role!"


Sso\WebserviceBundle\Entity\Webservice\Type\Role:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - ApplicationRole_Add
                - ApplicationRole_Update
            fields: Id
            message: "r00##Invalid role-id##Role-id already in use."
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - ApplicationRole_Add
                message: "r00##Invalid role-id##Role-id should not be empty."
            - Length:
                groups:
                    - Default
                    - ApplicationRole_Add
                min: 64
                max: 64
                exactMessage: "r01##Invalid role-id##Role-id should have exactly 64 characters."
        Name:
            - NotBlank:
                groups:
                    - Default
                    - ApplicationRole_Add
                    - ApplicationRole_Show
                    - ApplicationRole_Update
                    - ApplicationRole_Delete
                    - UserApplicationRole_Delete
                    - UserApplicationRole_Add
                message: "r10##Invalid role-name##Role-name should not be empty."
            - Length:
                groups:
                    - Default
                    - ApplicationRole_Add
                    - ApplicationRole_Show
                    - ApplicationRole_Update
                    - ApplicationRole_Delete
                    - UserApplicationRole_Delete
                    - UserApplicationRole_Add
                max: 127
                maxMessage: "r11##Invalid role-name##Role-name cannot be longer than 127 characters."
        Description:
            - Length:
                groups:
                    - Default
                    - ApplicationRole_Add
                max: 255
                maxMessage: "r20##Invalid role-description##Role-description cannot be longer than 255 characters."
        Application:
            - NotBlank:
                groups:
                    - Default
                message: "r30##Missing application##Role must be linked to an application!"
        UserApplicationRoles:
            - Count:
                groups:
                    - ApplicationRole_Delete
                min: 0
                max: 0
                exactMessage: "r40##User dependencies##There are users linked to role. Delete links first."


Sso\WebserviceBundle\Entity\Webservice\Type\User:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - User_Add
            fields: Id
            message: "u00##Invalid user-id##User-id already in use."
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - User_Add
            fields: Guid
            message: "u40##Invalid GUID##GUID already in use."
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            groups:
                - Default
                - User_Add
            fields: LowerEmail
            message: "u10##Invalid email-address##Email-address already in use."
            errorPath: Email
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            fields: LowerUsername
            message: "u20##Invalid username##Username already in use."
            errorPath: Username
            groups:
                - Default
                - User_Add
                - User_ChangePassword
                - UserService_PasswordConfirm
        - Sso\WebserviceBundle\Validator\Constraints\PasswordPolicy:
            message: "pp1##Password Policy Mismatch##Password does not satisfy policy: {{ violations }}"
            errorPath: Password
            groups:
                - Default
                - User_Add
                - User_Update
                - User_ChangePassword
                - User_ResetPassword
                - UserService_PasswordConfirm
        - Callback: validatePasswordEncryptType
    properties:
        Id:
            - NotBlank:
                groups:
                    - Default
                    - User_Add
                message: "u01##Invalid user-id##User-id should not be empty."
            - Length:
                groups:
                    - Default
                    - User_Add
                min: 64
                max: 64
                exactMessage: "u02##Invalid user-id##User-id should have exactly 64 characters."
        Guid:
            - NotBlank:
                groups:
                    - Default
                    - Identify_By_Guid
                message: "u41##Invalid GUID##GUID should not be empty."
            - Length:
                groups:
                    - Default
                    - Identify_By_Guid
                max: 64
                maxMessage: "u42##Invalid GUID##Guid should have 64 characters or less."
            - Blank:
                groups:
                    - Identify_By_Email
                    - Identify_By_Username
                    - Identify_By_Identifier
                message: "u43##Guid set##You may specify ONLY one of Guid, Username, Email or Identifier. If you don't know, if it is a guid, username or email, use identifier."
        Email:
            - NotBlank:
                groups:
                    - Identify_By_Email
                message: "u11##Invalid email-address##Email-address should not be empty."
            - Length:
                groups:
                    - Default
                    - User_Add
                    - Identify_By_Email
                max: 127
                maxMessage: "u12##Invalid email-address##Email-address cannot be longer than 127 characters."
            - Email:
                groups:
                    - Default
                    - User_Add
                    - Identify_By_Email
                message: "u13##Invalid email-address##The email-address is not a valid email."
            - Regex:
                groups:
                    - Default
                    - User_Add
                    - Identify_By_Email
                pattern: "/\s/"
                match: false
                message: "u13##Invalid email-address##The email-address should not contain any whitespaces."
            - Blank:
                groups:
                    - Identify_By_Guid
                    - Identify_By_Username
                    - Identify_By_Identifier
                message: "u14##Email-address set##You may specify ONLY one of Guid, Username, Email or Identifier. If you don't know, if it is a guid, username or email, use identifier."
        Username:
            - NotBlank:
                groups:
                    - Default
                    - User_Add
                    - Identify_By_Username
                message: "u21##Invalid username##Username should not be empty."
            - Length:
                groups:
                    - Default
                    - User_Add
                    - Identify_By_Username
                min: 5
                max: 127
                minMessage: "u22##Invalid username##Username must be at least 5 characters or more."
                maxMessage: "u23##Invalid username##Username should have 127 characters or less."
            - Regex:
                groups:
                    - Default
                    - User_Add
                pattern: "/\\s/"
                match: false
                message: "u24##Invalid username##Username should not have any whitespaces."
            - Blank:
                groups:
                    - Identify_By_Guid
                    - Identify_By_Email
                    - Identify_By_Identifier
                message: "u26##Username set##You may specify ONLY one of Guid, Username, Email or Identifier. If you don't know, if it is a guid, username or email, use identifier."
        Firstname:
            - Length:
                groups:
                    - Default
                    - User_Add
                max: 127
                maxMessage: "u41##Invalid firstname##Firstname should have 127 characters or less."
        Lastname:
            - NotBlank:
                groups:
                    - Default
                    - User_Add
                message: "u50##Invalid lastname##Lastname should not be empty."
            - Length:
                groups:
                    - Default
                    - User_Add
                max: 127
                maxMessage: "u52##Invalid lastname##Lastname should have 127 characters or less."
        Active:
            - NotNull:
                groups:
                    - Default
                    - User_Add
                message: "u60##Invalid active-flag##Active flag should not be empty."
            - Choice:
                groups:
                    - Default
                    - User_Add
                choices: ["0","1"]
                message: "u61##Invalid active-flag##Active flag must be 1 or 0."
        Identifier:
            - NotBlank:
                groups:
                    - Identify_By_Identifier
                message: "u70##Invalid Identifier##Identifier should not be empty. Fill with GUID, username or email-address."
            - Length:
                groups:
                    - Identify_By_Identifier
                max: 127
                maxMessage: "u71##Invalid Identifier##Identifier should have 127 characters or less. Fill with GUID, username or email-address."
            - Blank:
                groups:
                    - Identify_By_Guid
                    - Identify_By_Email
                    - Identify_By_Username
                message: "u72##Identifier not empty##You may specify ONLY one of Guid, Username, Email or Identifier. If you don't know, if it is a guid, username or email, use identifier."
            - NotBlank:
                groups:
                    - Identify_Error
                message: "u73##Invalid identifiers##You may specify one of Guid, Username, Email or Identifier."
        AuthId:
            - Length:
                groups:
                    - Default
                    - User_Add
                    - User_Update
                max: 64
                maxMessage: "u80##Invalid auth-id##Auth-id should have 64 characters or less."
        LdapSearchAttributes:
            - Length:
                groups:
                    - Default
                    - User_Add
                    - User_Update
                max: 255
                maxMessage: "u90##Invalid Ldap-Search-Attributes##Ldap-Search-Attributes should have 255 characters or less."
        LdapSearchValue:
            - Length:
                groups:
                    - Default
                    - User_Add
                    - User_Update
                max: 127
                maxMessage: "u100##Invalid Ldap-Search-Value##Ldap-Search-Value should have 127 characters or less."
        MfaEnabled:
            - Choice:
                groups:
                    - User_Update
                    - User_Add
                choices: ["0","1"]
                message: "u61##Invalid active-flag##Active flag must be 1 or 0."
        MfaRecreate:
            - Choice:
                groups:
                    - User_Update
                    - User_Add
                choices: ["0","1"]
                message: "u61##Invalid active-flag##Active flag must be 1 or 0."
        ActivateTokenRecreate:
            - Choice:
                groups:
                    - User_Update
                    - User_Add
                choices: ["0","1"]
                message: "u120##Invalid activate-token-recreate-flag##ActivateTokenRecreate flag must be 1 or 0."
#        passwordPolicy:
#        lastPasswordChange:
        passwordExpired:
            - Choice:
                groups:
                    - User_Update
                    - User_Add
                choices: ["0","1"]
                message: "u120##Invalid password-expired-flag##PasswordExpired flag must be 1 or 0."
        passwordEncryptType:
            - Length:
                  max: 127
                  maxMessage: "u130##Invalid password-encrypt-type##PasswordEncryptType should have 127 characters or less."

Sso\WebserviceBundle\Entity\Webservice\Type\UserGroup:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
              fields: lowerName
              message: "u20##Invalid username##Group name already in use."
              errorPath: name
              groups:
                  - Default
                  - UserGroup_Add
                  - UserGroup_Update
    properties:
        name:
            - NotBlank:
                  groups:
                      - Default
                      - User_Add
                      - UserGroup_Update
                  message: "ug10##Invalid group name##Group name should not be empty."
            - Length:
                  groups:
                      - Default
                      - User_Add
                      - UserGroup_Update
                  max: 64
                  maxMessage: "u52##Invalid group name##Group name should have 64 characters or less."
