onufitness_mobile/lib/models/notification/get_all_notification_response_model.dart
2026-01-13 11:36:24 +05:30

114 lines
2.9 KiB
Dart

import 'dart:convert';
GetAllNotificationResponseModel getAllNotificationResponseModelFromJson(
String str,
) => GetAllNotificationResponseModel.fromJson(json.decode(str));
String getAllNotificationResponseModelToJson(
GetAllNotificationResponseModel data,
) => json.encode(data.toJson());
class GetAllNotificationResponseModel {
bool? isSuccess;
int? statusCode;
String? message;
Data? data;
dynamic errors;
GetAllNotificationResponseModel({
this.isSuccess,
this.statusCode,
this.message,
this.data,
this.errors,
});
factory GetAllNotificationResponseModel.fromJson(Map<String, dynamic> json) =>
GetAllNotificationResponseModel(
isSuccess: json["isSuccess"],
statusCode: json["statusCode"],
message: json["message"],
data: json["data"] == null ? null : Data.fromJson(json["data"]),
errors: json["errors"],
);
Map<String, dynamic> toJson() => {
"isSuccess": isSuccess,
"statusCode": statusCode,
"message": message,
"data": data?.toJson(),
"errors": errors,
};
}
class Data {
int? totalCount;
List<NotificationItem>? items;
int? totalUnseenCount;
Data({this.totalCount, this.items, this.totalUnseenCount});
factory Data.fromJson(Map<String, dynamic> json) => Data(
totalCount: json["totalCount"],
items:
json["items"] == null
? []
: List<NotificationItem>.from(
json["items"]!.map((x) => NotificationItem.fromJson(x)),
),
totalUnseenCount: json["totalUnseenCount"],
);
Map<String, dynamic> toJson() => {
"totalCount": totalCount,
"items":
items == null ? [] : List<dynamic>.from(items!.map((x) => x.toJson())),
"totalUnseenCount": totalUnseenCount,
};
}
class NotificationItem {
int? notificationId;
String? notificationTitle;
int? notificationType;
String? notificationTypeName;
String? userId;
bool? isSeen;
String? dataField;
String? createdAt;
NotificationItem({
this.notificationId,
this.notificationTitle,
this.notificationType,
this.notificationTypeName,
this.userId,
this.isSeen,
this.dataField,
this.createdAt,
});
factory NotificationItem.fromJson(Map<String, dynamic> json) =>
NotificationItem(
notificationId: json["notificationID"],
notificationTitle: json["notificationTitle"],
notificationType: json["notificationType"],
notificationTypeName: json["notificationTypeName"],
userId: json["userID"],
isSeen: json["isSeen"],
dataField: json["dataField"],
createdAt: json["createdAt"],
);
Map<String, dynamic> toJson() => {
"notificationID": notificationId,
"notificationTitle": notificationTitle,
"notificationType": notificationType,
"notificationTypeName": notificationTypeName,
"userID": userId,
"isSeen": isSeen,
"dataField": dataField,
"createdAt": createdAt,
};
}