from __future__ import annotations

from fastapi import APIRouter, Depends

from backend.app.api.schemas import SearchResponse
from backend.app.dependencies import get_search_service
from backend.app.services.search_service import SearchService

router = APIRouter(prefix="/search")


@router.get("", response_model=SearchResponse)
async def search(
    path: str,
    query: str,
    service: SearchService = Depends(get_search_service),
) -> SearchResponse:
    return service.search(path=path, query=query)
