% ┌                                                ┐
% │                     Setup                      │
% └                                                ┘
% Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{
    \typeout{[Setup] Setting up...}
    \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
    \title{\Huge \textbf{#1}}
    \author{\authorTitle}
    \makeatletter
    \makeatother
    \fancyhead{}
    \fancyhead[L]{#1}
    \fancyhead[R]{\authorHeaders}
    \fancyfoot{}
    \fancyfoot[L]{\today}
    \fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
    \fancypagestyle{plain}{%
        \fancyhead{}
        \fancyhead[L]{#1}
        \fancyhead[R]{\authorHeaders}
        \fancyfoot{}
        \fancyfoot[L]{\today}
        \fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
    }
}

% Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{
    \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
    \title{\Huge \textbf{#1}}
    \author{\authorTitle}
}


% Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[2][true]{
    \ifthenelse{\equal{#1}{true}}{
        \RequirePackage[a4paper,textwidth=28.5cm,textheight=20cm,landscape]{geometry}
        \RequirePackage{flowfram}
        \ffvadjustfalse
        \setlength{\columnsep}{1cm}
        \Ncolumn{3}
    }{
        \RequirePackage[a4paper,textwidth=28.5cm,textheight=20cm]{geometry}
    }
    \title{\Huge \textbf{#2}}
    \author{\authorTitle}
}


% ┌                                                ┐
% │                 Document start                 │
% └                                                ┘
% Start document command (required)
\newcommand{\startDocument}{
    % TODO: Cheat sheet needs different setup?
    \maketitle
    \pagestyle{fancy}
    \thispagestyle{fancy}

    \tcbset{
        mainboxstyle/.style={
                arc=3mm,
                colback=red!5!white,
                colframe=red!75!black,
                colbacktitle=red!75!black,
                fonttitle=\bfseries,
                enhanced,
                attach boxed title to top left={yshift=-2mm,xshift=5mm},
                breakable,
                top=0.4cm,
            }
    }
    \tikzset{
        overlaystyle/.style={
                draw=red!75!black,
                thick,
                fill=red!75!black,
                left,
                anchor=east,
                text=white,
                rounded corners=1mm,
                font=\bfseries,
                xshift=-5mm,
                yshift=1mm,
                inner xsep=3mm,
                inner ysep=1.5mm
            }
    }
}
