"""
User validation schemas.
"""
from marshmallow import pre_load, Schema, validates_schema, ValidationError
from marshmallow.fields import Bool, Email, Str
from marshmallow.validate import Length


class BasicUserSchema(Schema):
    email = Email(required=True)
    first_name = Str(required=True, validate=Length(max=100))
    last_name = Str(required=True, validate=Length(max=100))

    @pre_load
    def make_data(self, data, **kwargs):
        data['email'] = data.pop('email').lower().strip()
        data['first_name'] = data.pop('first_name').strip()
        data['last_name'] = data.pop('last_name').strip()
        return data


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password='Passwords didn\'t match')

a27e70dc501ab0beba958fb665736edc3a967293
<mask token>


class BasicUserSchema(Schema):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password="Passwords didn't match")

<mask token>


class BasicUserSchema(Schema):
    <mask token>
    <mask token>
    <mask token>

    @pre_load
    def make_data(self, data, **kwargs):
        data['email'] = data.pop('email').lower().strip()
        data['first_name'] = data.pop('first_name').strip()
        data['last_name'] = data.pop('last_name').strip()
        return data


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password="Passwords didn't match")

<mask token>


class BasicUserSchema(Schema):
    email = Email(required=True)
    first_name = Str(required=True, validate=Length(max=100))
    last_name = Str(required=True, validate=Length(max=100))

    @pre_load
    def make_data(self, data, **kwargs):
        data['email'] = data.pop('email').lower().strip()
        data['first_name'] = data.pop('first_name').strip()
        data['last_name'] = data.pop('last_name').strip()
        return data


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password="Passwords didn't match")

<mask token>
from marshmallow import pre_load, Schema, validates_schema, ValidationError
from marshmallow.fields import Bool, Email, Str
from marshmallow.validate import Length


class BasicUserSchema(Schema):
    email = Email(required=True)
    first_name = Str(required=True, validate=Length(max=100))
    last_name = Str(required=True, validate=Length(max=100))

    @pre_load
    def make_data(self, data, **kwargs):
        data['email'] = data.pop('email').lower().strip()
        data['first_name'] = data.pop('first_name').strip()
        data['last_name'] = data.pop('last_name').strip()
        return data


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password="Passwords didn't match")

"""
User validation schemas.
"""
from marshmallow import pre_load, Schema, validates_schema, ValidationError
from marshmallow.fields import Bool, Email, Str
from marshmallow.validate import Length


class BasicUserSchema(Schema):
    email = Email(required=True)
    first_name = Str(required=True, validate=Length(max=100))
    last_name = Str(required=True, validate=Length(max=100))

    @pre_load
    def make_data(self, data, **kwargs):
        data['email'] = data.pop('email').lower().strip()
        data['first_name'] = data.pop('first_name').strip()
        data['last_name'] = data.pop('last_name').strip()
        return data


class UserCreateSchema(BasicUserSchema):
    password = Str(required=True, validate=Length(min=8))
    confirm_password = Str(required=True, validate=Length(min=8))

    @validates_schema
    def validates_password_confirmation(self, data, **kwargs):
        if data['password'] != data['confirm_password']:
            raise ValidationError(confirm_password='Passwords didn\'t match')
