Files
c_trans_mobile/lib/features/home/data/models/notification_response.dart
jahongireshonqulov 1bf3e41abe Initial commit
2025-10-18 09:40:06 +05:00

80 lines
1.8 KiB
Dart

import 'package:cargocalculaterapp/core/models/name.dart';
class NotificationResponse {
NotificationResponse({this.notifications, this.totalCount});
NotificationResponse.fromJson(dynamic json) {
if (json['notifications'] != null) {
notifications = [];
json['notifications'].forEach((v) {
notifications?.add(Notifications.fromJson(v));
});
}
totalCount = json['totalCount'];
}
List<Notifications>? notifications;
int? totalCount;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (notifications != null) {
map['notifications'] = notifications?.map((v) => v.toJson()).toList();
}
map['totalCount'] = totalCount;
return map;
}
}
class Notifications {
Notifications({
this.id,
this.userUcode,
this.orderNumber,
this.text,
this.status,
this.isRead,
this.createdAt,
this.updatedAt,
this.v,
});
Notifications.fromJson(dynamic json) {
id = json['_id'];
userUcode = json['user_ucode'];
orderNumber = json['order_number'];
text = json['text'] != null ? Name.fromJson(json['text']) : null;
status = json['status'];
isRead = json['is_read'];
createdAt = json['createdAt'];
updatedAt = json['updatedAt'];
v = json['__v'];
}
String? id;
String? userUcode;
String? orderNumber;
Name? text;
String? status;
bool? isRead;
String? createdAt;
String? updatedAt;
int? v;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['_id'] = id;
map['user_ucode'] = userUcode;
map['order_number'] = orderNumber;
if (text != null) {
map['text'] = text?.toJson();
}
map['status'] = status;
map['is_read'] = isRead;
map['createdAt'] = createdAt;
map['updatedAt'] = updatedAt;
map['__v'] = v;
return map;
}
}