%% Copyright (C) 2018 The University of Sheffield
%%               2018 The University of Paris-Saclay
%%
%% License:
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1.3c of the License, or (at your option) any later version.
%%   OR
%%   The 2-clause BSD-style license.
%%
%%   SPDX-License-Identifier: LPPL-1.3c+ OR BSD-2-Clause

\NeedsTeXFormat{LaTeX2e}\relax
\ProvidesPackage{DOF-math_exam}
  [<isadofltxversion>%
  Document-Type Support Framework for math classes.]

\RequirePackage{DOF-COL}
\usepackage{sfmath}
\usepackage{amsmath}
\usepackage{lastpage}
\usepackage{scrlayer-scrpage}
\usepackage{exercise}

\cfoot{\small\textnormal{Page \thepage\ of \pageref{LastPage}}}

\def\dof@author{}%
\def\dof@affiliation{}%

\AtBeginDocument{%
  \author{\dof@author}
%  \institute{\dof@affiliation}
}


\def\leftadd#1#2{\expandafter\leftaddaux\expandafter{#1}{#2}{#1}}
\def\leftaddaux#1#2#3{\gdef#3{#1#2}}

\newcommand{\addauthor}[1]{%
  \ifthenelse{\equal{\dof@author}{}}{%
    \gdef\dof@author{#1}%
  }{%
    \leftadd\dof@author{\protect\and #1}%
  }
}

\newkeycommand\isaDofSectionAuthor[label=,type=,affiliation=,email=][1]{%
    \immediate\write\@auxout{\noexpand\addauthor{#1}}%
}

\newkeycommand\isaDofTextHeader[label=,type=,examSubject=,date=,timeAllowed=][1]{%
    \immediate\write\@auxout{\noexpand\title{#1}}%
}

\newkeycommand\isaDofSectionHeader[label=,type=,examSubject=,date=,timeAllowed=][1]{%
    \immediate\write\@auxout{\noexpand\title{#1}}%
}

\newkeycommand\isaDofSubsectionHeader[label=,type=,examSubject=,date=,timeAllowed=][1]{%
    \immediate\write\@auxout{\noexpand\title{#1}}%
}

\newkeycommand\isaDofTextAnswerFormalStep[label=,type=,justification=,term=][1]{%
  #1
}

\newkeycommand\isaDofTextAnswerYesNo[label=,type=,step_label=,yes_no=][1]{%
  #1
}

\newkeycommand\isaDofTextExamitem[label=,type=,concerns=][1]{%
  #1
}

\newkeycommand\isaDofTextTask[label=,type=,level=,type=,subitems=concerns=,mark=][1]{%
  #1
}

\newkeycommand\isaDofSubsubsectionExercise[label=,type=,Exercise.content=,concerns=,][1]{%
  \begin{Exercise}
  #1
  \end{Exercise}
}

\newkeycommand\isaDofSubsubsectionValidation[label=,type=,tests=,proofs=][1]{%
  #1
}

\newkeycommand\isaDofSubsubsectionSolution[label=,type=,content=,valids=,concerns=][1]{%
  \begin{Answer}
  #1
  \end{Answer}
}

\newkeycommand\isaDofSubsubsectionMathExam[label=,type=,content=,global_grade=][1]{%
  #1
}


\newkeycommand\isaDofOpenMonitorMathExam[label=,type=]{}
\newkeycommand\isaDofCloseMonitorMathExam[label=,type=]{}
