# Path: tests/helpers/movie_data.py
# class Actor(Document):
# 
#     name = CharField(indexed = True)
#     gross_income_m = FloatField(indexed = True)
#     salary_amount = FloatField(indexed = True,key = 'salary.amount')
#     salary_currency = CharField(indexed = True,key = 'salary.currency')
#     appearances = IntegerField(indexed = True)
#     birth_year = IntegerField(indexed = True)
#     favorite_food = ManyToManyField('Food')
#     is_funny = BooleanField(indexed = True)
#     movies = ManyToManyField('Movie',backref = 'actors')
# 
# class Director(Document):
# 
#     """
#     Warning: There is a circular foreign key relationship between
#     Director and Movie, hence trying to save a pair of those objects
#     that point to each other will yield an exception for e.g.
#     the Postgres backend.
#     """
# 
#     name = CharField(indexed = True)
#     favorite_actor = ForeignKeyField('Actor')
#     best_movie = ForeignKeyField('Movie',unique=True,backref = 'best_of_director')
# 
# class Movie(Document):
# 
#     title = CharField(nullable = True,indexed = True)
#     director = ForeignKeyField(related = 'Director',nullable = True,backref = 'movies')
#     cast = ManyToManyField(related = 'Actor')
#     year = IntegerField(indexed = True)
#     best_actor = ForeignKeyField('Actor',backref = 'best_movies')
# 
#     class Meta(Document.Meta):
# 
#         dbref_includes = ['title','year']


from ..helpers.movie_data import Actor, Director, Movie
        import sqlite3
# -*- coding: utf-8 -*-



def prepare_data(backend):

    backend.init_schema()
    backend.create_schema()

    francis_coppola = Director({'name' : 'Francis Coppola'})
    stanley_kubrick = Director({'name' : 'Stanley Kubrick'})
    robert_de_niro = Actor({'name' : 'Robert de Niro','movies' : []})
    harrison_ford = Actor({'name' : 'Harrison Ford'})
    andreas_dewes = Actor({'name' : 'Andreas Dewes'})
    brian_de_palma = Director({'name' : 'Brian de Palma'})

    al_pacino = Actor({'name' : 'Al Pacino','movies' : [],'salary' : {'amount' : 100000000,'currency' : u'€'}})


# Path: tests/helpers/movie_data.py
# class Actor(Document):
# 
#     name = CharField(indexed = True)
#     gross_income_m = FloatField(indexed = True)
#     salary_amount = FloatField(indexed = True,key = 'salary.amount')
#     salary_currency = CharField(indexed = True,key = 'salary.currency')
#     appearances = IntegerField(indexed = True)
#     birth_year = IntegerField(indexed = True)
#     favorite_food = ManyToManyField('Food')
#     is_funny = BooleanField(indexed = True)
#     movies = ManyToManyField('Movie',backref = 'actors')
# 
# class Director(Document):
# 
#     """
#     Warning: There is a circular foreign key relationship between
#     Director and Movie, hence trying to save a pair of those objects
#     that point to each other will yield an exception for e.g.
#     the Postgres backend.
#     """
# 
#     name = CharField(indexed = True)
#     favorite_actor = ForeignKeyField('Actor')
#     best_movie = ForeignKeyField('Movie',unique=True,backref = 'best_of_director')
# 
# class Movie(Document):
# 
#     title = CharField(nullable = True,indexed = True)
#     director = ForeignKeyField(related = 'Director',nullable = True,backref = 'movies')
#     cast = ManyToManyField(related = 'Actor')
#     year = IntegerField(indexed = True)
#     best_actor = ForeignKeyField('Actor',backref = 'best_movies')
# 
#     class Meta(Document.Meta):
# 
#         dbref_includes = ['title','year']


# Path: tests/sql/test_intersect.py
from ..helpers.movie_data import Actor, Director, Movie
        import sqlite3

# -*- coding: utf-8 -*-



def prepare_data(backend):

    backend.init_schema()
    backend.create_schema()

    francis_coppola = Director({'name' : 'Francis Coppola'})
    stanley_kubrick = Director({'name' : 'Stanley Kubrick'})
    robert_de_niro = Actor({'name' : 'Robert de Niro','movies' : []})
    harrison_ford = Actor({'name' : 'Harrison Ford'})
    andreas_dewes = Actor({'name' : 'Andreas Dewes'})
    brian_de_palma = Director({'name' : 'Brian de Palma'})

    al_pacino = Actor({'name' : 'Al Pacino','movies' : [],'salary' : {'amount' : 100000000,'currency' : u'€'}})


    scarface = Movie({'title' : 'Scarface','director' : brian_de_palma})