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

from app.database.session import get_db
from app.domain.entities.appointment_type import AppointmentTypeEntity
from app.infrastructure.appointment_types_service import AppointmentTypesService
from app.infrastructure.dependencies import get_current_user

router = APIRouter()


@router.get(
    "/",
    response_model=list[AppointmentTypeEntity],
    summary="Get all appointment types",
    description="Returns a list of all appointment types",
)
async def get_all_appointment_types(
        db: AsyncSession = Depends(get_db),
        user=Depends(get_current_user),
):
    appointment_types_service = AppointmentTypesService(db)
    return await appointment_types_service.get_all_appointment_types()
