from typing import Annotated, AsyncGenerator

from fastapi import Depends

from src.core.database import async_session_maker
from src.core.db_manager import DBManager
from src.core.interfaces import IUOWDB


async def get_db() -> AsyncGenerator[IUOWDB, None]:
    async with DBManager(async_session_maker) as db:
        yield db


sessionDep = Annotated[IUOWDB, Depends(get_db)]
