import 'package:freezed_annotation/freezed_annotation.dart'; import '../../../../../api/mhsl/custom_timetable_event/get/get_custom_timetable_event_response.dart'; import '../../../../../api/webuntis/queries/get_holidays/get_holidays_response.dart'; import '../../../../../api/webuntis/queries/get_rooms/get_rooms_response.dart'; import '../../../../../api/webuntis/queries/get_subjects/get_subjects_response.dart'; import '../../../../../api/webuntis/queries/get_timegrid_units/get_timegrid_units_response.dart'; import '../../../../../api/webuntis/queries/get_timetable/get_timetable_response.dart'; part 'timetable_state.freezed.dart'; part 'timetable_state.g.dart'; @freezed abstract class TimetableState with _$TimetableState { const TimetableState._(); const factory TimetableState({ @Default({}) Map weekCache, GetRoomsResponse? rooms, GetSubjectsResponse? subjects, GetHolidaysResponse? schoolHolidays, GetTimegridUnitsResponse? timegrid, GetCustomTimetableEventResponse? customEvents, required DateTime startDate, required DateTime endDate, @Default(0) int dataVersion, }) = _TimetableState; factory TimetableState.fromJson(Map json) => _$TimetableStateFromJson(json); Iterable getAllKnownLessons() => weekCache.values.expand((response) => response.result); bool get hasReferenceData => rooms != null && subjects != null && schoolHolidays != null && customEvents != null; }