# Path: rep0st/framework/data/database.py
# class DatabaseModule(Module):
#   url: URL
#   base: B
# 
#   def __init__(self, url: URL, base: B):
#     self.url = url
#     self.base = base
# 
#   def configure(self, binder: Binder):
#     from rep0st.framework.data.transaction import TransactionalModule
#     binder.install(TransactionalModule)
# 
#   @provider
#   @singleton
#   def provide_database_engine(self) -> DatabaseEngine:
#     engine = create_engine(self.url)
#     self.base.metadata.create_all(engine)
#     self.base.metadata.bind = engine
#     return engine
# 
#   @inject
#   @provider
#   @singleton
#   def provide_database_session_factory(
#       self, database_engine: DatabaseEngine) -> DatabaseSessionFactory:
#     return scoped_session(sessionmaker(database_engine))
# 
#   @inject
#   @provider
#   def provide_database_session(
#       self, database_session_factory: DatabaseSessionFactory) -> Session:
#     return database_session_factory()


from absl import flags
from injector import Module
from sqlalchemy.engine.url import make_url
from rep0st.db import Base
from rep0st.framework.data.database import DatabaseModule


FLAGS = flags.FLAGS
flags.DEFINE_string('rep0st_database_uri', '',
                    'Database URI used by rep0st to store data.')

# Path: rep0st/framework/data/database.py
# class DatabaseModule(Module):
#   url: URL
#   base: B
# 
#   def __init__(self, url: URL, base: B):
#     self.url = url
#     self.base = base
# 
#   def configure(self, binder: Binder):
#     from rep0st.framework.data.transaction import TransactionalModule
#     binder.install(TransactionalModule)
# 
#   @provider
#   @singleton
#   def provide_database_engine(self) -> DatabaseEngine:
#     engine = create_engine(self.url)
#     self.base.metadata.create_all(engine)
#     self.base.metadata.bind = engine
#     return engine
# 
#   @inject
#   @provider
#   @singleton
#   def provide_database_session_factory(
#       self, database_engine: DatabaseEngine) -> DatabaseSessionFactory:
#     return scoped_session(sessionmaker(database_engine))
# 
#   @inject
#   @provider
#   def provide_database_session(
#       self, database_session_factory: DatabaseSessionFactory) -> Session:
#     return database_session_factory()


# Path: rep0st/config/rep0st_database.py
from absl import flags
from injector import Module
from sqlalchemy.engine.url import make_url
from rep0st.db import Base
from rep0st.framework.data.database import DatabaseModule



FLAGS = flags.FLAGS
flags.DEFINE_string('rep0st_database_uri', '',
                    'Database URI used by rep0st to store data.')

flags.DEFINE_string(