class AppNotification { final String id; final String title; final String? description; final String type; // 'PUBLIC' | 'JOIN_REQUEST' final String? groupId; final bool? isAccepted; final String receiverId; final String? senderId; const AppNotification({ required this.id, required this.title, this.description, required this.type, this.groupId, this.isAccepted, required this.receiverId, this.senderId, }); factory AppNotification.fromJson(Map json) { return AppNotification( id: json['id'].toString(), title: json['title'] as String, description: json['description'] as String?, type: (json['type'] as String?) ?? 'PUBLIC', groupId: json['group_id']?.toString(), isAccepted: json['is_accepted'] as bool?, receiverId: json['receiver_id'].toString(), senderId: json['sender_id']?.toString(), ); } bool get isJoinRequest => type == 'JOIN_REQUEST'; bool get isPending => isAccepted == null; }