from fastapi import APIRouter, Request

router = APIRouter()

@router.get("/provider/inbox")
def provider_inbox(request: Request, provider_id: str):
    cur = request.state.db.cursor()
    cur.execute("""
        SELECT * FROM app.v_provider_inbox
        WHERE provider_listing_id = %s
        ORDER BY created_at DESC
    """, (provider_id,))
    rows = cur.fetchall()
    return rows
