module Utils.Schedule.Types
  ( ScheduleCourseEventInfo
  , ScheduleTutorialInfo
  , ScheduleExamOccurrenceInfo
  , ScheduleExamOccurrenceJoinedInfo
  , ScheduleEntry(..)
  ) where

import Import


type ScheduleCourseEventInfo = (Entity Course, Entity CourseEvent)

type ScheduleTutorialInfo = (Entity Course, Entity Tutorial)

type ScheduleExamOccurrenceInfo       = (Entity Course, Entity Exam, Entity ExamOccurrence)
type ScheduleExamOccurrenceJoinedInfo = (Entity Course, Entity Exam, NonEmpty (Entity ExamOccurrence))

data ScheduleEntry = ScheduleCourseEvent
                     { sceCourse     :: Entity Course  -- TODO: just course?
                     , sceType       :: CourseEventType
                     , sceRoom       :: CourseEventRoom
                     , sceOccurrence :: Either OccurrenceException OccurrenceSchedule
                     }
                   | ScheduleTutorial
                     { stCourse      :: Entity Course
                     , stName        :: TutorialName
                     , stType        :: TutorialType
                     , stRoom        :: Maybe Text  -- TODO: introduce TutorialRoom type synonym
                     , stOccurrence  :: Either OccurrenceException OccurrenceSchedule
                     }
                   | ScheduleExamOccurrence
                     { seoCourse     :: Entity Course
                     , seoExamName   :: ExamName
                     , seoRooms      :: NonEmpty ExamOccurrenceRoom
                     , seoStart      :: UTCTime
                     , seoEnd        :: Maybe UTCTime
                     }
                   deriving (Generic, Typeable)
