# 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):


from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin
from flask import current_app
from sqlalchemy.orm import backref
import requests
import datetime as dt
# -*- coding: utf-8 -*-


class BlacklistCharacter(SurrogatePK, TimeMixin, Model):
    __tablename__ = 'blacklist_character'
    # __searchable__ = ['name', 'main_name', 'corporation', 'alliance', 'notes', 'ip_address']

    name = Column(db.Unicode, nullable=True)
    main_name = Column(db.Unicode, nullable=True)
    corporation = Column(db.Unicode)
    alliance = Column(db.Unicode)
    notes = Column(db.Unicode)

    ip_address = Column(db.Unicode)

    creator_id = ReferenceCol('users', nullable=True)
    creator = relationship('User', foreign_keys=[creator_id], backref='blacklist_character_entries')

    def __repr__(self):
        return '<' + self.name + ': ' + self.notes + '>'


# A cache table and wrapper for the GSF blacklist

# 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/blacklist/models.py
from recruit_app.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK, TimeMixin
from flask import current_app
from sqlalchemy.orm import backref
import requests
import datetime as dt

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


class BlacklistCharacter(SurrogatePK, TimeMixin, Model):
    __tablename__ = 'blacklist_character'
    # __searchable__ = ['name', 'main_name', 'corporation', 'alliance', 'notes', 'ip_address']

    name = Column(db.Unicode, nullable=True)
    main_name = Column(db.Unicode, nullable=True)
    corporation = Column(db.Unicode)
    alliance = Column(db.Unicode)
    notes = Column(db.Unicode)

    ip_address = Column(db.Unicode)

    creator_id = ReferenceCol('users', nullable=True)
    creator = relationship('User', foreign_keys=[creator_id], backref='blacklist_character_entries')

    def __repr__(self):
        return '<' + self.name + ': ' + self.notes + '>'


# A cache table and wrapper for the GSF blacklist

class BlacklistGSF(TimeMixin, Model):