from flask_restx import fields 

PASSWORD_REGEX = r'^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,}$'



class Password(fields.String):
    __schema_type__      = 'string'
    __schema_format__    = 'password'

    def validate(self, value): 
        if not PASSWORD_REGEX.match(value):
            return False
        return True