"""
Static pages routes for Ohm Stream Downloader API.
"""

from fastapi import APIRouter, Request
from fastapi.responses import RedirectResponse

router = APIRouter(tags=["static"])


def get_templates():
    from main import templates

    return templates


@router.get("/web")
async def web_interface(request: Request):
    """Web interface"""
    templates = get_templates()
    return templates.TemplateResponse("index.html", {"request": request})


@router.get("/login")
async def login_page(request: Request):
    """Login/Register page"""
    templates = get_templates()
    return templates.TemplateResponse("login.html", {"request": request})


@router.get("/watchlist")
async def watchlist_redirect():
    """Redirect /watchlist to web interface with watchlist hash"""
    return RedirectResponse("/web#watchlist")
