Files
sfm_app_final/lib/feature/bell/bell_model.dart
2024-12-15 00:59:02 +07:00

76 lines
1.6 KiB
Dart

class Bell {
int? offset;
String? result;
List<BellItems>? items;
Bell({
this.offset,
this.result,
this.items,
});
Bell.fromJson(Map<String, dynamic> json) {
offset = json["offset"];
result = json["result"];
if (json['items'] != null) {
items = [];
json['items'].forEach((v) {
items!.add(BellItems.fromJson(v));
});
} else {
items = [];
}
}
}
class BellItems {
String? id;
String? notifiType;
String? userId;
String? eventType;
ItemDetail? itemDetail;
int? status;
DateTime? createdAt;
DateTime? updatedAt;
BellItems(
{this.id, this.eventType, this.status, this.createdAt, this.updatedAt});
BellItems.fromJson(Map<String, dynamic> json) {
id = json["id"];
notifiType = json["notifi_type"];
userId = json["user_id"];
eventType = json["event_type"];
status = json["status"];
itemDetail =
json['detail'] != null ? ItemDetail.fromJson(json['detail']) : null;
createdAt = DateTime.parse(json["created_at"]);
updatedAt = DateTime.parse(json["updated_at"]);
}
static List<BellItems> fromJsonDynamicList(List<dynamic> list) {
return list.map((e) => BellItems.fromJson(e)).toList();
}
}
class ItemDetail {
String? sourceId;
String? sourceName;
String? targetId;
String? targetName;
ItemDetail({
this.sourceId,
this.sourceName,
this.targetId,
this.targetName,
});
ItemDetail.fromJson(Map<String, dynamic> json) {
sourceId = json["source_id"];
sourceName = json["source_name"];
targetId = json["target_id"];
targetName = json["target_name"];
}
}