# /opt/docker/dev/service_finder/backend/app/api/recommend.py
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import text
from app.db.session import get_db
from app.api import deps

router = APIRouter()

# Secured endpoint: Closed premium ecosystem
@router.get("/provider/inbox")
async def provider_inbox(
    provider_id: str,
    db: AsyncSession = Depends(get_db),
    current_user = Depends(deps.get_current_user)
):
    """ Aszinkron szerviz-postaláda lekérdezés. """
    query = text("""
        SELECT * FROM marketplace.service_profiles
        WHERE id = :p_id
    """)
    result = await db.execute(query, {"p_id": provider_id})
    return [dict(row._mapping) for row in result.fetchall()]