Files
Traders_Circuit/lib/model/Notification/notification_model.dart
Rajshinde046 a1a9490c3d notification
2024-04-12 19:34:25 +05:30

140 lines
3.3 KiB
Dart

class GetNotification {
final String? status;
final int? statusCode;
final String? message;
final Data? data;
GetNotification({
this.status,
this.statusCode,
this.message,
this.data,
});
factory GetNotification.fromJson(Map<String, dynamic> json) {
return GetNotification(
status: json['status'],
statusCode: json['status_code'],
message: json['message'],
data: json['data'] != null ? Data.fromJson(json['data']) : null,
);
}
Map<String, dynamic> toJson() {
return {
'status': status,
'status_code': statusCode,
'message': message,
if (data != null) 'data': data!.toJson(),
};
}
}
class Data {
final List<NotificationItem>? list;
final int? count;
Data({
this.list,
this.count,
});
factory Data.fromJson(Map<String, dynamic> json) {
return Data(
list: json['list'] != null
? (json['list'] as List)
.map((v) => NotificationItem.fromJson(v))
.toList()
: null,
count: json['count'],
);
}
Map<String, dynamic> toJson() {
return {
'list': list?.map((v) => v.toJson()).toList(),
'count': count,
};
}
}
class NotificationItem {
final int? id;
final String? messageName;
final int? userId;
final int? userType;
final String? notificationTitle;
final String? notificationMessage;
final String? notificationImage;
final int? isSchedule;
final String? deliverySchedule;
final int? isRead;
final String? isActive;
final String? createdBy;
final String? modifiedBy;
final String? deletedAt;
final String? createdAt;
final String? updatedAt;
NotificationItem({
this.id,
this.messageName,
this.userId,
this.userType,
this.notificationTitle,
this.notificationMessage,
this.notificationImage,
this.isSchedule,
this.deliverySchedule,
this.isRead,
this.isActive,
this.createdBy,
this.modifiedBy,
this.deletedAt,
this.createdAt,
this.updatedAt,
});
factory NotificationItem.fromJson(Map<String, dynamic> json) {
return NotificationItem(
id: json['id'],
messageName: json['message_name'],
userId: json['user_id'],
userType: json['user_type'],
notificationTitle: json['notification_title'],
notificationMessage: json['notification_message'],
notificationImage: json['notification_image'],
isSchedule: json['is_schedule'],
deliverySchedule: json['delivery_schedule'],
isRead: json['is_read'],
isActive: json['is_active'],
createdBy: json['created_by'],
modifiedBy: json['modified_by'],
deletedAt: json['deleted_at'],
createdAt: json['created_at'],
updatedAt: json['updated_at'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'message_name': messageName,
'user_id': userId,
'user_type': userType,
'notification_title': notificationTitle,
'notification_message': notificationMessage,
'notification_image': notificationImage,
'is_schedule': isSchedule,
'delivery_schedule': deliverySchedule,
'is_read': isRead,
'is_active': isActive,
'created_by': createdBy,
'modified_by': modifiedBy,
'deleted_at': deletedAt,
'created_at': createdAt,
'updated_at': updatedAt,
};
}
}