// Consolidated notification models class AdminNotification { String? priority; List? registrationIds; String? accessid; String? title; String? body; String? sound; AdminNotification({ this.priority, this.registrationIds, this.accessid, this.title, this.body, this.sound, }); factory AdminNotification.fromJson(Map json) { return AdminNotification( priority: json['priority'] as String?, registrationIds: json['registration_ids']?.cast(), accessid: json['data']?['accessid'] as String?, title: json['notification']?['title'] as String?, body: json['notification']?['body'] as String?, sound: json['notification']?['sound'] as String?, ); } Map toJson() { final Map data = {}; data['priority'] = priority; data['registration_ids'] = registrationIds; if (accessid != null) { data['data'] = {'accessid': accessid}; } if (title != null || body != null || sound != null) { data['notification'] = { if (title != null) 'title': title, if (body != null) 'body': body, if (sound != null) 'sound': sound, }; } return data; } } class NotificationMessage { String? sender; String? accessid; String? priority; String? to; String? title; String? body; String? sound; NotificationMessage({ this.sender, this.accessid, this.priority, this.to, this.title, this.body, this.sound, }); factory NotificationMessage.fromJson(Map json) { return NotificationMessage( sender: json['sender'] as String?, accessid: json['accessid'] as String?, priority: json['notification']?['priority'] as String?, to: json['notification']?['to'] as String?, title: json['notification']?['notification']?['title'] as String?, body: json['notification']?['notification']?['body'] as String?, sound: json['notification']?['notification']?['sound'] as String?, ); } Map toJson() { final Map data = {}; data['sender'] = sender; data['accessid'] = accessid; if (priority != null || to != null || title != null || body != null || sound != null) { data['notification'] = { if (priority != null) 'priority': priority, if (to != null) 'to': to, if (title != null || body != null || sound != null) 'notification': { if (title != null) 'title': title, if (body != null) 'body': body, if (sound != null) 'sound': sound, }, }; } return data; } } class RiderNotification { String? token; String? title; String? body; String? sound; String? image; RiderNotification({ this.token, this.title, this.body, this.sound, this.image, }); factory RiderNotification.fromJson(Map json) { return RiderNotification( token: json['token'] as String?, title: json['notification']?['title'] as String?, body: json['notification']?['body'] as String?, sound: json['notification']?['sound'] as String?, image: json['notification']?['image'] as String?, ); } Map toJson() { final Map data = {}; data['token'] = token; if (title != null || body != null || sound != null || image != null) { data['notification'] = { if (title != null) 'title': title, if (body != null) 'body': body, if (sound != null) 'sound': sound, if (image != null) 'image': image, }; } return data; } }