"""
Ryan Faulkner, 2014

Schema definitions for sqlalchemy
"""

from sqlalchemy import Column, Integer, String, BigInteger
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class User(Base):
    """ Elements for Flickipedia users """

    __tablename__ = 'Users'

    _id = Column(BigInteger, primary_key=True, autoincrement=True)
    handle = Column(String(32))
    email = Column(String(24))
    firstname = Column(String(24))
    lastname = Column(String(24))
    password = Column(String(64))
    date_join = Column(Integer)

    def __repr__(self):
        return "<User(handle='%s', first='%s', last='%s')>" % (
            self.handle, self.firstname, self.lastname)


class Photo(Base):
    """ Elements for Flickr Photos """

    __tablename__ = 'Photos'

    _id = Column(BigInteger, primary_key=True, autoincrement=True)
    flickr_id = Column(BigInteger)
    article_id = Column(BigInteger)
    votes = Column(Integer)

    def __repr__(self):
        return "<Photo(photo='%s', article='%s', votes='%s')>" % (
            self.photo, self.article, self.votes)


class Article(Base):
    """ Elements for wiki articles """

    __tablename__ = 'Articles'

    _id = Column(BigInteger, primary_key=True, autoincrement=True)
    wiki_aid = Column(BigInteger)
    article_name = Column(String(32))

    def __repr__(self):
        return "<Article(name='%s', article='%s', votes='%s')>" % (
            self.article_name, self.article, self.votes)


class Like(Base):
    """ Elements for likes on article photos for flickr """

    __tablename__ = 'Likes'

    _id = Column(BigInteger, primary_key=True, autoincrement=True)
    user_id = Column(BigInteger)
    photo_id = Column(BigInteger)
    article_id = Column(BigInteger)

    def __repr__(self):
        return "<Like(user='%s', flickr_id='%s', article_id='%s')>" % (
            self.user_id, self.flickr_pid, self.article_id)
@@ -1921,8 +1921,456 @@
 icle_id)
+%0A%0A%0Aclass Exclude(Base):%0A    %22%22%22 Elements for likes on article photos for flickr %22%22%22%0A%0A    __tablename__ = 'Exclusions'%0A%0A    _id = Column(BigInteger, primary_key=True, autoincrement=True)%0A    user_id = Column(BigInteger)%0A    photo_id = Column(BigInteger)%0A    article_id = Column(BigInteger)%0A%0A    def __repr__(self):%0A        return %22%3CExclude(user='%25s', flickr_id='%25s', article_id='%25s')%3E%22 %25 (%0A            self.user_id, self.flickr_pid, self.article_id)

add - model for photo exclusions