from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, DeclarativeBase

from .config import get_settings

settings = get_settings()

internal_engine = create_engine(
    settings.internal_db_url,
    pool_pre_ping=True,
    pool_size=5,
    max_overflow=10,
)

platform_engine = create_engine(
    settings.platform_db_url,
    pool_pre_ping=True,
    pool_size=5,
    max_overflow=10,
)

InternalSession = sessionmaker(bind=internal_engine, autoflush=False, autocommit=False)
PlatformSession = sessionmaker(bind=platform_engine, autoflush=False, autocommit=False)


class InternalBase(DeclarativeBase):
    pass


class PlatformBase(DeclarativeBase):
    pass
