%
%   ▄▄█▀▀▀█▄█                         
% ▄██▀     ▀█                         
% ██▀       ▀ ▄██▀██▄▀███▄███  ▄▄█▀██ 
% ██         ██▀   ▀██ ██▀ ▀▀ ▄█▀   ██
% ██▄        ██     ██ ██     ██▀▀▀▀▀▀
% ▀██▄     ▄▀██▄   ▄██ ██     ██▄    ▄
%   ▀▀█████▀  ▀█████▀▄████▄    ▀█████▀

% This file contains all necessary dependencies for the document to compile (at all) and some core macros
% Load this before the config file

% ── Imports ─────────────────────────────────────────────────────────
\typeout{[Core] Importing!}

\usepackage[table, dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\usepackage[most]{tcolorbox}
\usepackage{cancel}
\usepackage{dsfont}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{ulem}
\usepackage{soul}
\usepackage{parskip}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{tocloft}
\usepackage{wasysym}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{ifthen}
\usepackage[hidelinks]{hyperref}
\usepackage{enumitem}
\usepackage{gensymb}
\usepackage{pifont}


% ── Language Switching. ─────────────────────────────────────────────
% Currently only English and German are supported
% See docs for how to use
\newcounter{lang}

\newcommand{\setLang}[1]{
	\edef\lang{#1}
	\edef\en{en}
	\edef\de{de}
	\ifx\lang\en
		\typeout{[Lang Switcher] Loading English}
		\setcounter{lang}{1}
	\else
		\ifx\lang\de
			\typeout{[Lang Switcher] Loading German}
			\setcounter{lang}{2}
			\usepackage[ngerman]{babel}
		\else
			\typeout{[Lang Switcher] No such language!}
		\fi
	\fi
}

% Deprecated, as not useful
\newcommand{\loadLang}{
	\ifnum\value{lang}<2{
		\typeout{[Lang Loader] Loaded English}
		}\else {
			\typeout{[Lang Loader] Loaded German}
			\setcounter{lang}{2}
		}
	\fi
}


% ────────────────────────────────────────────────────────────────────
% Create config counters / variables. See the config file for changing them
\newcounter{numberingConfig}
\newcounter{numberSubsections}
\newcounter{descriptorShadeStrength}
\newcounter{shadeStrength}

% ── 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...}
	\loadLang
	\usepackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
	\title{\Huge \textbf{#1}}
	\author{\authorTitle}
	\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}}
	}
	\typeout{[Setup] Complete}
}

% Start document command (required)
\newcommand{\startDocument}{
	\maketitle
	\startDocumentNoTitle
}

% Or this one, if you don't want a title
\newcommand{\startDocumentNoTitle}{
	\pagestyle{fancy}
	\thispagestyle{fancy}
}

% Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{
	\typeout{[Setup] Using barebones setup}
	\loadLang
	\usepackage[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}[1]{
	\typeout{[Setup] Using CheatSheet setup}
	\loadLang
	\usepackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry}
	\title{\Huge \textbf{#1}}
	\author{\authorTitle}
}


% ────────────────────────────────────────────────────────────────────
%          ╭────────────────────────────────────────────────╮
%          │                 Translatation                  │
%          ╰────────────────────────────────────────────────╯
\newcommand{\translate}[2]{\ifnum\value{lang}<2{#1}\else{#2}\fi}
\newcommand{\tr}[2]{\translate{#1}{#2}}

% ┌                                                ┐
% │        Translation aids (commonly used)        │
% └                                                ┘
\newcommand{\trif}{\translate{if }{falls }}
\newcommand{\trIf}{\translate{If }{Falls }}
\newcommand{\trLet}{\translate{Let }{Sei }}
\newcommand{\trLets}{\translate{Let }{Seien }}
\newcommand{\trFor}{\translate{For }{Für }}
\newcommand{\trfor}{\translate{for }{für }}
\newcommand{\trand}{\translate{and }{und }}
\newcommand{\tror}{\translate{or }{oder }}
\newcommand{\trst}{\translate{s.t. }{s.d. }}
\newcommand{\trsuchthat}{\translate{such that }{so dass }}
\newcommand{\trwith}{\translate{with }{mit }}
