# Path: nflpool/data/teaminfo.py
# class TeamInfo(SqlAlchemyBase):
#     __tablename__ = "TeamInfo"
#     team_id = sqlalchemy.Column(sqlalchemy.Integer, index=True, primary_key=True)
#     name = sqlalchemy.Column(sqlalchemy.String)
#     city = sqlalchemy.Column(sqlalchemy.String)
#     team_abbr = sqlalchemy.Column(sqlalchemy.String)
#     conference_id = sqlalchemy.Column(sqlalchemy.Integer)
#     division_id = sqlalchemy.Column(sqlalchemy.Integer)
# 
# Path: nflpool/data/dbsession.py
# class DbSessionFactory:
#     factory = None
# 
#     # Start a database session at app startup
#     @staticmethod
#     def global_init(db_file):
#         if DbSessionFactory.factory:
#             return
# 
#         if not db_file or not db_file.strip():
#             raise Exception("You must specify a data file.")
# 
#         conn_str = "sqlite:///" + db_file
#         print("Connecting to db with conn string: {}".format(conn_str))
# 
#         engine = sqlalchemy.create_engine(conn_str, echo=False)
# 
#         SqlAlchemyBase.metadata.create_all(engine)
#         DbSessionFactory.factory = sqlalchemy.orm.sessionmaker(bind=engine)
# 
#     @staticmethod
#     def create_session():
#         return DbSessionFactory.factory()
# 
# Path: nflpool/data/divisioninfo.py
# class DivisionInfo(SqlAlchemyBase):
#     __tablename__ = "DivisionInfo"
#     division_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
#     division = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/conferenceinfo.py
# class ConferenceInfo(SqlAlchemyBase):
#     __tablename__ = "ConferenceInfo"
#     conf_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
#     conference = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/picktypes.py
# class PickTypes(SqlAlchemyBase):
#     __tablename__ = "PickTypes"
#     pick_type_id = sqlalchemy.Column(
#         sqlalchemy.Integer, primary_key=True, autoincrement=True
#     )
#     name = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/pick_type_points.py
# class PickTypePoints(SqlAlchemyBase):
#     __tablename__ = "PickTypePoints"
#     primary_key = sqlalchemy.Column(
#         sqlalchemy.Integer, primary_key=True, autoincrement=True
#     )
#     pick_type_id = sqlalchemy.Column(sqlalchemy.Integer)
#     place = sqlalchemy.Column(sqlalchemy.Integer)
#     points = sqlalchemy.Column(sqlalchemy.Integer)
# 
# Path: nflpool/data/seasoninfo.py
# class SeasonInfo(SqlAlchemyBase):
#     __tablename__ = "SeasonInfo"
#     id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True)
#     current_season = sqlalchemy.Column(sqlalchemy.Integer)
#     season_start_date = sqlalchemy.Column(sqlalchemy.String)
#     home_team = sqlalchemy.Column(sqlalchemy.String)
#     away_team = sqlalchemy.Column(sqlalchemy.String)


from nflpool.data.teaminfo import TeamInfo
from requests.auth import HTTPBasicAuth
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.divisioninfo import DivisionInfo
from nflpool.data.conferenceinfo import ConferenceInfo
from nflpool.data.picktypes import PickTypes
from nflpool.data.pick_type_points import PickTypePoints
from nflpool.data.seasoninfo import SeasonInfo
import requests
import nflpool.data.secret as secret


class NewInstallService:
    @staticmethod
    def get_install():
        return []

    """From MySportsFeeds get the team name, team city, team ID and abbreviation.  Loop through
    the AFC teams (0 in the API) and NFC (1) in the API.  The Division IDs are self created.  This method
    will fill the TeamInfo table in the database."""

    @staticmethod
    def get_team_info():

        session = DbSessionFactory.create_session()

# Path: nflpool/data/teaminfo.py
# class TeamInfo(SqlAlchemyBase):
#     __tablename__ = "TeamInfo"
#     team_id = sqlalchemy.Column(sqlalchemy.Integer, index=True, primary_key=True)
#     name = sqlalchemy.Column(sqlalchemy.String)
#     city = sqlalchemy.Column(sqlalchemy.String)
#     team_abbr = sqlalchemy.Column(sqlalchemy.String)
#     conference_id = sqlalchemy.Column(sqlalchemy.Integer)
#     division_id = sqlalchemy.Column(sqlalchemy.Integer)
# 
# Path: nflpool/data/dbsession.py
# class DbSessionFactory:
#     factory = None
# 
#     # Start a database session at app startup
#     @staticmethod
#     def global_init(db_file):
#         if DbSessionFactory.factory:
#             return
# 
#         if not db_file or not db_file.strip():
#             raise Exception("You must specify a data file.")
# 
#         conn_str = "sqlite:///" + db_file
#         print("Connecting to db with conn string: {}".format(conn_str))
# 
#         engine = sqlalchemy.create_engine(conn_str, echo=False)
# 
#         SqlAlchemyBase.metadata.create_all(engine)
#         DbSessionFactory.factory = sqlalchemy.orm.sessionmaker(bind=engine)
# 
#     @staticmethod
#     def create_session():
#         return DbSessionFactory.factory()
# 
# Path: nflpool/data/divisioninfo.py
# class DivisionInfo(SqlAlchemyBase):
#     __tablename__ = "DivisionInfo"
#     division_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
#     division = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/conferenceinfo.py
# class ConferenceInfo(SqlAlchemyBase):
#     __tablename__ = "ConferenceInfo"
#     conf_id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
#     conference = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/picktypes.py
# class PickTypes(SqlAlchemyBase):
#     __tablename__ = "PickTypes"
#     pick_type_id = sqlalchemy.Column(
#         sqlalchemy.Integer, primary_key=True, autoincrement=True
#     )
#     name = sqlalchemy.Column(sqlalchemy.String)
# 
# Path: nflpool/data/pick_type_points.py
# class PickTypePoints(SqlAlchemyBase):
#     __tablename__ = "PickTypePoints"
#     primary_key = sqlalchemy.Column(
#         sqlalchemy.Integer, primary_key=True, autoincrement=True
#     )
#     pick_type_id = sqlalchemy.Column(sqlalchemy.Integer)
#     place = sqlalchemy.Column(sqlalchemy.Integer)
#     points = sqlalchemy.Column(sqlalchemy.Integer)
# 
# Path: nflpool/data/seasoninfo.py
# class SeasonInfo(SqlAlchemyBase):
#     __tablename__ = "SeasonInfo"
#     id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True)
#     current_season = sqlalchemy.Column(sqlalchemy.Integer)
#     season_start_date = sqlalchemy.Column(sqlalchemy.String)
#     home_team = sqlalchemy.Column(sqlalchemy.String)
#     away_team = sqlalchemy.Column(sqlalchemy.String)


# Path: nflpool/services/new_install_service.py
from nflpool.data.teaminfo import TeamInfo
from requests.auth import HTTPBasicAuth
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.divisioninfo import DivisionInfo
from nflpool.data.conferenceinfo import ConferenceInfo
from nflpool.data.picktypes import PickTypes
from nflpool.data.pick_type_points import PickTypePoints
from nflpool.data.seasoninfo import SeasonInfo
import requests
import nflpool.data.secret as secret



class NewInstallService:
    @staticmethod
    def get_install():
        return []

    """From MySportsFeeds get the team name, team city, team ID and abbreviation.  Loop through
    the AFC teams (0 in the API) and NFC (1) in the API.  The Division IDs are self created.  This method
    will fill the TeamInfo table in the database."""

    @staticmethod
    def get_team_info():

        session = DbSessionFactory.create_session()

        season_query = session.query(SeasonInfo.current_season).first()