"""
Route registration module for StarPunk

This module handles registration of all route blueprints including public,
admin, auth, and (conditionally) dev auth routes.
"""

from flask import Flask

from starpunk.routes import admin, auth, micropub, public, search


def register_routes(app: Flask) -> None:
    """
    Register all route blueprints with the Flask app

    Args:
        app: Flask application instance

    Registers:
        - Public routes (homepage, note permalinks)
        - Auth routes (login, callback, logout, token, authorization)
        - Micropub routes (Micropub API endpoint)
        - Admin routes (dashboard, note management)
        - Dev auth routes (if DEV_MODE enabled)
    """
    # Register public routes
    app.register_blueprint(public.bp)

    # Register auth routes
    app.register_blueprint(auth.bp)

    # Register Micropub routes
    app.register_blueprint(micropub.bp)

    # Register admin routes
    app.register_blueprint(admin.bp)

    # Register search routes
    app.register_blueprint(search.bp)

    # Conditionally register dev auth routes
    if app.config.get("DEV_MODE"):
        app.logger.warning(
            "=" * 60
            + "\n"
            + "WARNING: Development authentication enabled!\n"
            + "This should NEVER be used in production.\n"
            + "Set DEV_MODE=false for production deployments.\n"
            + "=" * 60
        )
        from starpunk.routes import dev_auth

        app.register_blueprint(dev_auth.bp)
