-- SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later

Tutorial json
    name            TutorialName
    course          CourseId OnDeleteCascade OnUpdateCascade
    type            (CI Text) -- "Tutorium", "Zentralübung", ...
    capacity        Int Maybe -- limit for enrolment in this tutorial    
    roomHidden      Bool default=false
    time            (JSONB Occurrences)
    regGroup        (CI Text) Maybe -- each participant may register for one tutorial per regGroup
    registerFrom    UTCTime Maybe
    registerTo      UTCTime Maybe
    deregisterUntil UTCTime Maybe
    lastChanged     UTCTime default=now()
    tutorControlled Bool default=false
    firstDay        Day Maybe -- to be computed from time, but needed for sorting within DB
    UniqueTutorial course name
    deriving Generic
Tutor
    tutorial    TutorialId OnDeleteCascade OnUpdateCascade
    user        UserId
    UniqueTutor tutorial user
    deriving Generic
TutorialParticipant
    tutorial        TutorialId OnDeleteCascade OnUpdateCascade
    user            UserId
    company         CompanyId Maybe
    drivingPermit   UserDrivingPermit Maybe
    eyeExam         UserEyeExam Maybe
    note            Text Maybe
    UniqueTutorialParticipant tutorial user
    deriving Eq Ord Show Generic
TutorialParticipantDay
    tutorial        TutorialId  OnDeleteCascade OnUpdateCascade
    user            UserId      OnDeleteCascade OnUpdateCascade
    day             Day
    attendance      Bool default=true
    note            Text Maybe
    UniqueTutorialParticipantDay tutorial user day
    deriving Show Generic