BitBag\SyliusCmsPlugin\Entity\Media:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            fields: [code]
            groups: ['bitbag']
            message: 'bitbag_sylius_cms_plugin.media.code.unique'
        - BitBag\SyliusCmsPlugin\Validator\Constraint\FileMatchesType:
              groups: [ 'bitbag' ]
              messageImage: 'bitbag_sylius_cms_plugin.media.file.type_image'
              messageVideo: 'bitbag_sylius_cms_plugin.media.file.type_video'
              field: 'type'
    properties:
        code:
            - NotBlank:
                message: 'bitbag_sylius_cms_plugin.media.code.not_blank'
                groups: ['bitbag']
            - Length:
                min: 2
                max: 250
                minMessage: 'bitbag_sylius_cms_plugin.media.code.min_length'
                maxMessage: 'bitbag_sylius_cms_plugin.media.code.max_length'
                groups: ['bitbag']
            - Regex:
                  pattern: '/^[\w-]*$/'
                  message: 'bitbag_sylius_cms_plugin.media.code.regex'
                  groups: [ 'bitbag' ]
        file:
            - Expression:
                expression: '!(this.getPath() == null and this.getFile() == null)'
                message: 'bitbag_sylius_cms_plugin.media.file.not_blank'
                groups: ['bitbag']
        translations:
            - Valid: ~
