# Path: recruit_app/extensions.py

# 
# Path: recruit_app/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
# class TimeMixin(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=True, pk_name='id', **kwargs):


import datetime as dt
from flask_security import UserMixin, RoleMixin
from flask_security.utils import verify_and_update_password, encrypt_password
from recruit_app.extensions import bcrypt
from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin
class EveApiKeyPair(Model):
    __tablename__ = 'api_key_pairs'

    api_id = Column(db.String(254), primary_key=True)
    api_key = Column(db.String(254))
    last_update_time = Column(db.DateTime(), nullable=True)
    last_scraped_time = Column(db.DateTime(), nullable=True, default=dt.date(day=1, month=1, year=1980))

    user_id = ReferenceCol('users', nullable=True)
    user = relationship('User', backref='api_keys', foreign_keys=[user_id])

    valid = Column(db.Boolean, default=True)

    def __str__(self):
        return self.api_id

class EveAllianceInfo(Model):
    __tablename__ = 'alliances'

    alliance_id = Column(db.String(254), primary_key=True)
    alliance_name = Column(db.String(254))
    alliance_ticker = Column(db.String(254))
    executor_corp_id = Column(db.String(254))
    is_blue = Column(db.Boolean, default=False)
    member_count = Column(db.Integer)

    def __str__(self):
        return self.alliance_name



# Path: recruit_app/extensions.py

# 
# Path: recruit_app/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
# class TimeMixin(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=True, pk_name='id', **kwargs):


# Path: recruit_app/user/models.py
import datetime as dt
from flask_security import UserMixin, RoleMixin
from flask_security.utils import verify_and_update_password, encrypt_password
from recruit_app.extensions import bcrypt
from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin

class EveApiKeyPair(Model):
    __tablename__ = 'api_key_pairs'

    api_id = Column(db.String(254), primary_key=True)
    api_key = Column(db.String(254))
    last_update_time = Column(db.DateTime(), nullable=True)
    last_scraped_time = Column(db.DateTime(), nullable=True, default=dt.date(day=1, month=1, year=1980))

    user_id = ReferenceCol('users', nullable=True)
    user = relationship('User', backref='api_keys', foreign_keys=[user_id])

    valid = Column(db.Boolean, default=True)

    def __str__(self):
        return self.api_id

class EveAllianceInfo(Model):
    __tablename__ = 'alliances'

    alliance_id = Column(db.String(254), primary_key=True)
    alliance_name = Column(db.String(254))
    alliance_ticker = Column(db.String(254))
    executor_corp_id = Column(db.String(254))
    is_blue = Column(db.Boolean, default=False)
    member_count = Column(db.Integer)

    def __str__(self):
        return self.alliance_name



class EveCorporationInfo(Model):