\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{PrimeTeX/Manual}[2025-08-16]

\RequirePackage{ifthen}

% Option 'electronic': single side printing.
\newboolean{isElectronic}
\setboolean{isElectronic}{false}

\DeclareOption{electronic}{
	\setboolean{isElectronic}{true}
}

% Option 'admin': turn on admin manual sections.
\newboolean{isAdminManual}
\setboolean{isAdminManual}{false}

\DeclareOption{admin}{
	\setboolean{isAdminManual}{true}
}

% Option 'darkmode': render as light text on dark background.
\newboolean{isDarkMode}
\setboolean{isDarkMode}{false}

\DeclareOption{darkmode}{
	\setboolean{isDarkMode}{true}
}

% Option 'draft': same as base book class, but with bigger overfull boxes.
\newboolean{isDraft}
\setboolean{isDraft}{false}

\DeclareOption{draft}{
	\setboolean{isDraft}{true}
	\overfullrule = 1in
}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}

\ProcessOptions\relax

\ifthenelse{\boolean{isElectronic}}{
	\ifthenelse{\boolean{isDraft}}{
		\LoadClass[draft,oneside]{book}
	}{
		\LoadClass[oneside]{book}
	}
}{
	\ifthenelse{\boolean{isDraft}}{
		\LoadClass[draft]{book}
	}{
		\LoadClass{book}
	}
}

\input{PrimeTeX/commonincludes.def}

\NewDocumentCommand{\IfAdminManual}{+m +m}{
	\ifthenelse{\boolean{isAdminManual}}{#1}{#2}
}

\NewDocumentCommand{\IfElectronic}{+m +m}{
	\ifthenelse{\boolean{isElectronic}}{#1}{#2}
}

\NewDocumentCommand{\rem}{+m}{}