from __future__ import annotations

from fastapi import APIRouter, Request, status

from app.models import DashboardSummary, QuickAddNotePayload

router = APIRouter(prefix='/api')


@router.get('/health')
def health() -> dict[str, str]:
    return {'status': 'ok'}


@router.get('/dashboard/summary', response_model=DashboardSummary)
def dashboard_summary(request: Request) -> dict:
    return request.app.state.store.dashboard_summary()


@router.post('/notes/quick-add', status_code=status.HTTP_201_CREATED)
def quick_add_note(payload: QuickAddNotePayload, request: Request) -> dict:
    return request.app.state.store.add_quick_note(payload.model_dump())
