# Path: bluespot/extensions.py



from bluespot.extensions import db
import datetime
import uuid
    guest_id    = db.Column(db.Integer, db.ForeignKey('guest.id'))
    sessions    = db.relationship('Guestsession', backref='device',lazy='dynamic')

class Guestsession(db.Model):
    ''' Class to represent guest session. Each session is associated to a Guest and will have a state associated with it.

    '''
    id          = db.Column(db.Integer, primary_key=True)
    device_id   = db.Column(db.Integer, db.ForeignKey('device.id'))
    starttime   = db.Column(db.DateTime,default=datetime.datetime.utcnow(),index=True)
    stoptime    = db.Column(db.DateTime,index=True)   #Time at which session is stopped, to be filled by session updator
    expiry      = db.Column(db.DateTime,index=True)   #predicted expiry time,default to 60 minutes
    temp_login  = db.Column(db.Integer,default=0)
    duration    = db.Column(db.Integer,default=60)
    ban_ends    = db.Column(db.DateTime,index=True)
    data_used   = db.Column(db.String(20))            #Data used up in this session
    state       = db.Column(db.Integer)
    mac         = db.Column(db.String(30),index=True)
    auth_code   = db.Column(db.String(20))            #Authorization code for this session, used for vouchers
    d_updated   = db.Column(db.String(20))            #data updated last
    duration    = db.Column(db.Integer)               #Duration in seconds the session lasted, updated by session updator   
    guesttracks = db.relationship('Guesttrack', backref='guestsession',lazy='dynamic')


class Guesttrack(db.Model):
    ''' Class to track connection attempts, this is also used to track login process

    '''
    id          = db.Column(db.Integer, primary_key=True)
    track_id    = db.Column(db.String(40),index=True,unique=True)

# Path: bluespot/extensions.py



# Path: bluespot/guest/models.py
from bluespot.extensions import db
import datetime
import uuid

    guest_id    = db.Column(db.Integer, db.ForeignKey('guest.id'))
    sessions    = db.relationship('Guestsession', backref='device',lazy='dynamic')

class Guestsession(db.Model):
    ''' Class to represent guest session. Each session is associated to a Guest and will have a state associated with it.

    '''
    id          = db.Column(db.Integer, primary_key=True)
    device_id   = db.Column(db.Integer, db.ForeignKey('device.id'))
    starttime   = db.Column(db.DateTime,default=datetime.datetime.utcnow(),index=True)
    stoptime    = db.Column(db.DateTime,index=True)   #Time at which session is stopped, to be filled by session updator
    expiry      = db.Column(db.DateTime,index=True)   #predicted expiry time,default to 60 minutes
    temp_login  = db.Column(db.Integer,default=0)
    duration    = db.Column(db.Integer,default=60)
    ban_ends    = db.Column(db.DateTime,index=True)
    data_used   = db.Column(db.String(20))            #Data used up in this session
    state       = db.Column(db.Integer)
    mac         = db.Column(db.String(30),index=True)
    auth_code   = db.Column(db.String(20))            #Authorization code for this session, used for vouchers
    d_updated   = db.Column(db.String(20))            #data updated last
    duration    = db.Column(db.Integer)               #Duration in seconds the session lasted, updated by session updator   
    guesttracks = db.relationship('Guesttrack', backref='guestsession',lazy='dynamic')


class Guesttrack(db.Model):
    ''' Class to track connection attempts, this is also used to track login process

    '''
    id          = db.Column(db.Integer, primary_key=True)
    track_id    = db.Column(db.String(40),index=True,unique=True)

    session_id  = db.Column(db.Integer, db.ForeignKey('guestsession.id'))