from __future__ import annotations

from fastapi import APIRouter, Depends, Query

from backend.app.api.schemas import BrowseResponse
from backend.app.dependencies import get_browse_service
from backend.app.services.browse_service import BrowseService

router = APIRouter()


@router.get("/browse", response_model=BrowseResponse)
async def browse(
    path: str = Query(...),
    show_hidden: bool = Query(False),
    service: BrowseService = Depends(get_browse_service),
) -> BrowseResponse:
    return service.browse(path=path, show_hidden=show_hidden)
