from __future__ import annotations

from fastapi import FastAPI
from fastapi.responses import RedirectResponse

from .pages import admin, data, login, serving, task_detail, task_logs, task_new, tasks


def register_ui_routes(app: FastAPI) -> None:
    @app.get("/ui")
    async def ui_root() -> RedirectResponse:
        return RedirectResponse(url="/ui/tasks")

    login.register(app)
    tasks.register(app)
    task_new.register(app)
    task_detail.register(app)
    task_logs.register(app)
    serving.register(app)
    data.register(app)
    admin.register(app)

