import '../../models/notification_model.dart'; import '../interfaces/notification_service.dart'; import '../api/api_client.dart'; class MockNotificationService implements NotificationService { final List _items = [ const NotificationModel( id: 'n-0001', title: 'به‌روزرسانی سامانه', description: 'ساعت ۲۲ سرویس برای ۱۵ دقیقه در دسترس نیست.', type: NotificationType.public, isAccepted: null, receiverId: 'all', senderId: 'admin', groupId: null, ), const NotificationModel( id: 'n-0002', title: 'درخواست عضویت', description: 'کاربر ali_karimi درخواست عضویت ارسال کرده است.', type: NotificationType.joinRequest, isAccepted: null, receiverId: 'admin', senderId: 'u-0002', groupId: 'g-0001', ), ]; @override Future getNotifications() async { await Future.delayed(const Duration(milliseconds: 350)); return List.unmodifiable(_items); } @override Future sendPublicNotification(String title, String description) async { await Future.delayed(const Duration(milliseconds: 300)); if (title.trim().isEmpty) { throw const ApiException(statusCode: 400, message: 'عنوان الزامی است'); } final item = NotificationModel( id: 'n-${_items.length + 1}', title: title, description: description, type: NotificationType.public, isAccepted: null, receiverId: 'all', senderId: 'admin', groupId: null, ); _items.insert(0, item); } }