import 'package:finlytic_app/core/network/api_client.dart'; import 'package:finlytic_app/features/calendar/models/corporate_event_model.dart'; class CalendarRepository { final ApiClient apiClient; CalendarRepository({required this.apiClient}); Future> fetchEvents() async { try { final res = await apiClient.get('/api/v1/calendar'); if (res.statusCode == 200 && res.data != null) { final List data = res.data; return data.map((json) => CorporateEventModel.fromJson(json)).toList(); } return []; } catch (e) { print('Error fetching calendar events: $e'); throw Exception('Kalender-Termine konnten nicht geladen werden'); } } }