from fastapi import Request
from folkugat_web.services import sessions as sessions_service
from folkugat_web.templates import templates


def notes(request: Request, session_id: int, logged_in: bool):
    session = sessions_service.get_session(session_id=session_id)
    return templates.TemplateResponse(
        "fragments/sessio/notes.html",
        {
            "request": request,
            "logged_in": logged_in,
            "session_id": session_id,
            "session": session,
            "notes": session.notes if session and session.notes else "",
        }
    )


def notes_editor(request: Request, session_id: int):
    session = sessions_service.get_session(session_id=session_id)
    return templates.TemplateResponse(
        "fragments/sessio/notes_editor.html",
        {
            "request": request,
            "session_id": session_id,
            "notes": session.notes if session and session.notes else "",
            "max": max,
        }
    )
