from fastapi import Request
from folkugat_web.config import nota as config
from folkugat_web.templates import templates


def input(request: Request, value: str | None = None):
    return templates.TemplateResponse(
        "fragments/nota/input.html",
        {
            "request": request,
            "value": value,
        }
    )


def footer(request: Request, value: str | None, logged_in: bool):
    response = templates.TemplateResponse(
        "fragments/nota/footer.html",
        {
            "request": request,
            "value": config.LOGGED_IN_FOOTER if logged_in else value,
            "logged_in": logged_in,
        }
    )
    return response


def nota(request: Request):
    return templates.TemplateResponse(
        "fragments/nota/nota.html",
        {
            "request": request,
        },
        headers={"HX-Refresh": "true"},
    )
