""" Add Movie module"""

from db.movie import MOVIE


def add_movie_validation(movie):
    """Add movie validation func"""
    if len(movie['title']) < 7:
        raise ValueError('title must contain more than 7 characters')

    if len(movie['year']) != 4:
        raise ValueError('invalid year')

    return AddMovie(movie['title'], movie['year']).add_movie_to_db()


class AddMovie:
    """Add Movie class"""
    def __init__(self, title, year,):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({
            "title": self.title,
            "year": self.year
        })

48fb29a9cf74bde8114143d3c955f7b509d1b2cb
<mask token>


class AddMovie:
    <mask token>

    def __init__(self, title, year):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({'title': self.title, 'year': self.year})

<mask token>


class AddMovie:
    """Add Movie class"""

    def __init__(self, title, year):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({'title': self.title, 'year': self.year})

<mask token>


def add_movie_validation(movie):
    """Add movie validation func"""
    if len(movie['title']) < 7:
        raise ValueError('title must contain more than 7 characters')
    if len(movie['year']) != 4:
        raise ValueError('invalid year')
    return AddMovie(movie['title'], movie['year']).add_movie_to_db()


class AddMovie:
    """Add Movie class"""

    def __init__(self, title, year):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({'title': self.title, 'year': self.year})

<mask token>
from db.movie import MOVIE


def add_movie_validation(movie):
    """Add movie validation func"""
    if len(movie['title']) < 7:
        raise ValueError('title must contain more than 7 characters')
    if len(movie['year']) != 4:
        raise ValueError('invalid year')
    return AddMovie(movie['title'], movie['year']).add_movie_to_db()


class AddMovie:
    """Add Movie class"""

    def __init__(self, title, year):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({'title': self.title, 'year': self.year})

""" Add Movie module"""

from db.movie import MOVIE


def add_movie_validation(movie):
    """Add movie validation func"""
    if len(movie['title']) < 7:
        raise ValueError('title must contain more than 7 characters')

    if len(movie['year']) != 4:
        raise ValueError('invalid year')

    return AddMovie(movie['title'], movie['year']).add_movie_to_db()


class AddMovie:
    """Add Movie class"""
    def __init__(self, title, year,):
        self.title = title
        self.year = year

    def __repr__(self):
        return f'<Movie>  {self.title}, {self.year} '

    def add_movie_to_db(self):
        """Add data to Mongodb"""
        MOVIE.insert_one({
            "title": self.title,
            "year": self.year
        })
