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

from db.session import get_db
from core.deps import get_current_user

from domains.users.schemas import UserResponse
from domains.users.repo import get_all_users

router = APIRouter(
    prefix="/users",
    tags=["users"]
)


@router.get("/", response_model=list[UserResponse])
async def list_users(
    db: AsyncSession = Depends(get_db),
    user=Depends(get_current_user)
):
    """
    List all users. Regular users can use this to find people to invite to groups.
    """
    return await get_all_users(db)
