import '../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart'; import '../../../../api/mhsl/custom_timetable_event/custom_timetable_event.dart'; sealed class ArbitraryAppointment { const ArbitraryAppointment(); T when({ required T Function(McTimetableEntry lesson) lesson, required T Function(CustomTimetableEvent event) custom, }) => switch (this) { LessonAppointment(:final entry) => lesson(entry), CustomAppointment(:final event) => custom(event), }; } class LessonAppointment extends ArbitraryAppointment { final McTimetableEntry entry; const LessonAppointment(this.entry); } class CustomAppointment extends ArbitraryAppointment { final CustomTimetableEvent event; const CustomAppointment(this.event); }