Allocation -- attributes with prefix staff- affect lecturers only, but are invisble to students
    name                (CI Text)
    shorthand           (CI Text)       -- practical shorthand
    term                TermId
    school              SchoolId        -- school that manages this central allocation, not necessarily school of courses
    description         Html Maybe      -- description for prospective students
    staffDescription    Html Maybe      -- description seen by prospective lecturers only
    linkExternal        Text Maybe      -- arbitrary user-defined url for external course page
    capacity            Int Maybe       -- number of allowed enrolements, if restricte
    staffRegisterFrom   UTCTime Maybe   -- lectureres may register courses
    staffRegisterTo     UTCTime Maybe   -- course registration stops
    -- staffDeregisterUntil not needed: staff may make arbitrary changes until staffRegisterTo, always frozen afterwards
    staffAllocationFrom UTCTime Maybe   -- lecturers may rate applicants from this day onwwards or prohibited
    staffAllocationTo   UTCTime Maybe   --
    -- Student register for this allocation
    -- canRegisterNow = maybe False (<= currentTime) registerFrom && maybe True (>= currentTime) registerTo
    registerFrom        UTCTime Maybe   -- student applications allowed from a given day onwwards or prohibited
    registerTo          UTCTime Maybe   -- student applications may be prohibited from a given date onwards
    -- deregisterUntil not needed: students may withdraw applicants until registerTo, but never after. Also see overrideDeregister
    registerSecret      Text Maybe      -- student application maybe protected by a simple common passphrase
    -- overrides
    registerByStaffFrom UTCTime Maybe   -- lecturers may directly enrol/disenrol students after a given date or prohibited
    registerByStaffTo   UTCTime Maybe
    registerByCourse    UTCTime Maybe   -- course registration dates are ignored until this day has passed or always prohibited
    overrideDeregister  UTCTime Maybe   -- course deregistration enforced to be this date, i.e. students may disenrol from course after or never
    -- overrideVisible not needed, since courses are always visible
    TermSchoolAllocationShort  term school shorthand    -- shorthand must be unique within school and semester
    TermSchoolAllocationName   term school name         -- name must be unique within school and semester

AllocationCourse
    allocation          AllocationId
    course              CourseId
    minCapacity         Int          -- if the course would get assigned fewer than this many applicants, restart the assignment process without the course
    instructions        Html Maybe   -- instructions from the lecturer to applicants
    applicationText     Bool         -- lecturer will read application texts supplied by users
    applicationFiles    UploadMode   -- lecturer wants to receive course specific application files
    ratingsVisible      Bool         -- lecturer wants applicants to receive feedback on their application (Grade & comment)
    UniqueAllocationCourse course

AllocationCourseFile
    allocationCourse    AllocationCourseId
    file                FileId
    UniqueAllocationCourseFile allocationCourse file

AllocationUser
    allocation          AllocationId
    user                UserId
    totalCourses        Natural          -- number of total allocated courses for this user must be <= than this number
    UniqueAllocationUser allocation user

AllocationApplication
    allocationCourse    AllocationCourseId
    allocationUser      AllocationUserId
    text                Text       Maybe -- free text entered by user
    priority            Natural          -- priority, higher number means higher priority
    ratingVeto          Bool
    ratingPoints        ExamGrade Maybe
    ratingComment       Text      Maybe
    UniqueAllocationApplication allocationCourse allocationUser

AllocationApplicationFile -- supplemental file for application by a user for a certain course
    application          AllocationApplicationId
    file                 FileId
    UniqueAllocationUserFile application file

AllocationDeregister -- self-inflicted user-deregistrations from an allocated course
    user                UserId
    allocation          AllocationId Maybe
    course              CourseId Maybe
    time                UTCTime
    reason              Text Maybe -- if this deregistration was done by proxy (e.g. the lecturer pressed the button)
