import 'dart:convert'; ParentCommentResponseModel parentCommentResponseModelFromJson(String str) => ParentCommentResponseModel.fromJson(json.decode(str)); String parentCommentResponseModelToJson(ParentCommentResponseModel data) => json.encode(data.toJson()); class ParentCommentResponseModel { bool? isSuccess; int? statusCode; String? message; CommentData? data; dynamic errors; ParentCommentResponseModel({ this.isSuccess, this.statusCode, this.message, this.data, this.errors, }); factory ParentCommentResponseModel.fromJson(Map json) => ParentCommentResponseModel( isSuccess: json["isSuccess"], statusCode: json["statusCode"], message: json["message"], data: json["data"] == null ? null : CommentData.fromJson(json["data"]), errors: json["errors"], ); Map toJson() => { "isSuccess": isSuccess, "statusCode": statusCode, "message": message, "data": data?.toJson(), "errors": errors, }; } class CommentData { int? totalCount; List? items; CommentData({this.totalCount, this.items}); factory CommentData.fromJson(Map json) => CommentData( totalCount: json["totalCount"], items: json["items"] == null ? [] : List.from( json["items"]!.map((x) => CommentItem.fromJson(x)), ), ); Map toJson() => { "totalCount": totalCount, "items": items == null ? [] : List.from(items!.map((x) => x.toJson())), }; } class CommentItem { List? subComments; int? totalSubCommentCount; String? firstName; String? lastName; String? fullName; String? profilePicture; int? commentId; int? postId; String? commentText; DateTime? createdAt; CommentItem({ this.subComments, this.totalSubCommentCount, this.firstName, this.lastName, this.fullName, this.profilePicture, this.commentId, this.postId, this.commentText, this.createdAt, }); factory CommentItem.fromJson(Map json) => CommentItem( subComments: json["subComments"] == null ? [] : List.from( json["subComments"]!.map((x) => CommentItem.fromJson(x)), ), totalSubCommentCount: json["totalSubCommentCount"], firstName: json["firstName"], lastName: json["lastName"], fullName: json["fullName"], profilePicture: json["profilePicture"], commentId: json["commentID"], postId: json["postID"], commentText: json["commentText"], createdAt: json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]), ); Map toJson() => { "subComments": subComments == null ? [] : List.from(subComments!.map((x) => x.toJson())), "totalSubCommentCount": totalSubCommentCount, "firstName": firstName, "lastName": lastName, "fullName": fullName, "profilePicture": profilePicture, "commentID": commentId, "postID": postId, "commentText": commentText, "createdAt": createdAt?.toIso8601String(), }; }