# Path: seedbox/constants.py
# INIT = 'init'
# READY = 'ready'
# ACTIVE = 'active'
# DONE = 'done'
# CANCELLED = 'cancelled'
# STATES = [INIT, READY, ACTIVE, DONE, CANCELLED]
# ACTIVE_STATES = [INIT, READY, ACTIVE]
# INACTIVE_STATES = [DONE, CANCELLED]


import datetime
import operator
import re
import six
import sqlalchemy as sa
from sqlalchemy.ext import declarative
from sqlalchemy import orm
from seedbox import constants
        :return: dictionary items
        :rtype: iterator
        """
        local = dict(self)
        joined = dict(
            [(name, value) for name, value in six.iteritems(self.__dict__)
             if not name[0] == '_'])
        local.update(joined)
        return six.iteritems(local)


class HasId(object):
    """Table mixin providing a class/table id attribute"""
    id = sa.Column(sa.Integer, primary_key=True)


class HasTimestamp(object):
    """Table mixin providing a class/table date attributes"""
    created_at = sa.Column(sa.DateTime, default=datetime.datetime.utcnow)
    updated_at = sa.Column(sa.DateTime, onupdate=datetime.datetime.utcnow)


class Torrent(Base, HasId, HasTimestamp):
    """Class representing a torrent in the database"""

    __table_args__ = {
        'sqlite_autoincrement':  True,
    }

    name = sa.Column(sa.String(255), unique=True)

# Path: seedbox/constants.py
# INIT = 'init'
# READY = 'ready'
# ACTIVE = 'active'
# DONE = 'done'
# CANCELLED = 'cancelled'
# STATES = [INIT, READY, ACTIVE, DONE, CANCELLED]
# ACTIVE_STATES = [INIT, READY, ACTIVE]
# INACTIVE_STATES = [DONE, CANCELLED]


# Path: seedbox/db/sqlalchemy/models.py
import datetime
import operator
import re
import six
import sqlalchemy as sa
from sqlalchemy.ext import declarative
from sqlalchemy import orm
from seedbox import constants

        :return: dictionary items
        :rtype: iterator
        """
        local = dict(self)
        joined = dict(
            [(name, value) for name, value in six.iteritems(self.__dict__)
             if not name[0] == '_'])
        local.update(joined)
        return six.iteritems(local)


class HasId(object):
    """Table mixin providing a class/table id attribute"""
    id = sa.Column(sa.Integer, primary_key=True)


class HasTimestamp(object):
    """Table mixin providing a class/table date attributes"""
    created_at = sa.Column(sa.DateTime, default=datetime.datetime.utcnow)
    updated_at = sa.Column(sa.DateTime, onupdate=datetime.datetime.utcnow)


class Torrent(Base, HasId, HasTimestamp):
    """Class representing a torrent in the database"""

    __table_args__ = {
        'sqlite_autoincrement':  True,
    }

    name = sa.Column(sa.String(255), unique=True)

    state = sa.Column(sa.Enum(*constants.STATES), default=constants.INIT)