# Path: farmsList/extensions.py

# 
# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):


import datetime as dt
from flask.ext.login import UserMixin
from farmsList.extensions import bcrypt
from farmsList.database import (
    Column,
    db,
    Model,
    ReferenceCol,
    relationship,
    SurrogatePK,
)
# -*- coding: utf-8 -*-



class Role(SurrogatePK, Model):
    __tablename__ = 'roles'
    name = Column(db.String(80), unique=True, nullable=False)
    user_id = ReferenceCol('users', nullable=True)
    user = relationship('User', backref='roles')

    def __init__(self, name, **kwargs):
        db.Model.__init__(self, name=name, **kwargs)

    def __repr__(self):
        return '<Role({name})>'.format(name=self.name)

class Email(SurrogatePK, Model):
    __tablename__ = 'emails'
    sender = Column(db.String(80), nullable=False)
    recipients = Column(db.String(2000), nullable=False)

# Path: farmsList/extensions.py

# 
# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):


# Path: farmsList/user/models.py
import datetime as dt
from flask.ext.login import UserMixin
from farmsList.extensions import bcrypt
from farmsList.database import (
    Column,
    db,
    Model,
    ReferenceCol,
    relationship,
    SurrogatePK,
)

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



class Role(SurrogatePK, Model):
    __tablename__ = 'roles'
    name = Column(db.String(80), unique=True, nullable=False)
    user_id = ReferenceCol('users', nullable=True)
    user = relationship('User', backref='roles')

    def __init__(self, name, **kwargs):
        db.Model.__init__(self, name=name, **kwargs)

    def __repr__(self):
        return '<Role({name})>'.format(name=self.name)

class Email(SurrogatePK, Model):
    __tablename__ = 'emails'
    sender = Column(db.String(80), nullable=False)
    recipients = Column(db.String(2000), nullable=False)

    body = Column(db.String(6250000), nullable=False)