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


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


def footer(request, value, logged_in):
    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):
    response = templates.TemplateResponse(
        "fragments/nota/nota.html",
        {
            "request": request,
        }
    )
    response.headers["HX-Refresh"] = "true"
    return response
