/// User security / inbox notifications. library; class SecurityNotificationModel { const SecurityNotificationModel({ required this.id, required this.eventType, required this.title, required this.body, this.readAt, required this.createdAt, }); final String id; final String eventType; final String title; final String body; final String? readAt; final String createdAt; bool get isUnread => readAt == null || readAt!.isEmpty; factory SecurityNotificationModel.fromJson(Map json) => SecurityNotificationModel( id: (json['id'] ?? '').toString(), eventType: (json['eventType'] ?? '').toString(), title: (json['title'] ?? '').toString(), body: (json['body'] ?? '').toString(), readAt: json['readAt']?.toString(), createdAt: (json['createdAt'] ?? '').toString(), ); } class SecurityNotificationsPage { const SecurityNotificationsPage({ required this.items, required this.total, required this.unreadCount, }); final List items; final int total; final int unreadCount; factory SecurityNotificationsPage.fromJson(Map json) => SecurityNotificationsPage( items: (json['items'] as List? ?? []) .map((e) => SecurityNotificationModel.fromJson(e as Map)) .toList(), total: (json['total'] as num?)?.toInt() ?? 0, unreadCount: (json['unreadCount'] as num?)?.toInt() ?? 0, ); }