"""Main routes for the application.""" from flask import Blueprint from app.services.decorators import get_current_user, require_auth from app.services.greeting_service import GreetingService bp = Blueprint("main", __name__) @bp.route("/") def index() -> dict[str, str]: """Root endpoint that returns a greeting.""" return GreetingService.get_greeting() @bp.route("/hello") @bp.route("/hello/") def hello(name: str | None = None) -> dict[str, str]: """Hello endpoint with optional name parameter.""" return GreetingService.get_greeting(name) @bp.route("/protected") @require_auth def protected() -> dict[str, str]: """Protected endpoint that requires authentication.""" user = get_current_user() return { "message": f"Hello {user['name']}, this is a protected endpoint!", "user": user } @bp.route("/health") def health() -> dict[str, str]: """Health check endpoint.""" return {"status": "ok"}