"""admin/routers/support.py — Publishing help request routes. Routes: GET /{slug}/support/config POST /{slug}/support/publish-request POST /{slug}/support/contact """ from fastapi import APIRouter, Depends from sqlalchemy.ext.asyncio import AsyncSession from app.dependencies import get_current_author_scoped, get_db from app.schemas.admin import ContactRequest, PublishHelpRequest from app.services.support_service import SupportService router = APIRouter() @router.get("/{author_slug}/support/config") async def support_config( author_slug: str, current_user=Depends(get_current_author_scoped), ): """Return support contact info for the admin UI.""" return SupportService.get_config() @router.post("/{author_slug}/support/publish-request", status_code=202) async def publish_help_request( author_slug: str, body: PublishHelpRequest, current_user=Depends(get_current_author_scoped), db: AsyncSession = Depends(get_db), ): """Queue a publish-help email to the support inbox.""" return await SupportService(db).queue_publish_help_request(current_user, body) @router.post("/{author_slug}/support/contact", status_code=202) async def contact_request( author_slug: str, body: ContactRequest, current_user=Depends(get_current_author_scoped), db: AsyncSession = Depends(get_db), ): """Queue a general contact message to the support inbox.""" return await SupportService(db).queue_contact_request(current_user, body)