import '../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart';

/// Derives a human-readable title from the Marianum-Connect `lessonType` for
/// lessons that have no subject of their own (Aufsicht, Sprechstunde, …).
/// Shared between the calendar tile and the lesson detail sheet so both
/// surfaces show the same wording, with the room rendered first so it
/// survives a truncated tile.
class LessonTypeLabel {
  static const String fallback = 'Event';

  static String forEntry(McTimetableEntry lesson) {
    final base = baseLabel(lesson.lessonType);
    final room = (lesson.rooms.firstOrNull ?? '').trim();
    return room.isEmpty ? base : '$room $base';
  }

  /// Returns just the type wording without the room — useful when the caller
  /// renders the room separately (e.g. as a subtitle line).
  static String baseLabel(String lessonType) {
    switch (lessonType) {
      case 'BREAK_SUPERVISION':
        return 'Aufsicht';
      case 'OFFICE_HOUR':
        return 'Sprechstunde';
      case 'STANDBY':
        return 'Bereitschaft';
      case 'EXAM':
        return 'Prüfung';
      default:
        return fallback;
    }
  }
}
