from __future__ import annotations

from typing import Annotated

from fastapi import Depends
from sqlalchemy.ext.asyncio import AsyncSession

from core.auth.models import CurrentUser
from core.db import get_db
from v1.schedule_items.repository import SQLAlchemyScheduleItemRepository
from v1.schedule_items.service import ScheduleItemService
from v1.users.dependencies import get_current_user


def get_schedule_item_service(
    session: Annotated[AsyncSession, Depends(get_db)],
    user: Annotated[CurrentUser, Depends(get_current_user)],
) -> ScheduleItemService:
    repository = SQLAlchemyScheduleItemRepository(session)
    return ScheduleItemService(
        repository=repository,
        session=session,
        current_user=user,
    )
