onufitness_mobile/lib/screens/echoboard/models/singel_post_response_model.dart
2026-01-13 11:36:24 +05:30

235 lines
6.3 KiB
Dart

import 'dart:convert';
SingelPostResponseModel singelPostResponseModelFromJson(String str) =>
SingelPostResponseModel.fromJson(json.decode(str));
String singelPostResponseModelToJson(SingelPostResponseModel data) =>
json.encode(data.toJson());
class SingelPostResponseModel {
bool? isSuccess;
int? statusCode;
String? message;
SingelPostData? data;
dynamic errors;
SingelPostResponseModel({
this.isSuccess,
this.statusCode,
this.message,
this.data,
this.errors,
});
factory SingelPostResponseModel.fromJson(Map<String, dynamic> json) =>
SingelPostResponseModel(
isSuccess: json["isSuccess"],
statusCode: json["statusCode"],
message: json["message"],
data:
json["data"] == null ? null : SingelPostData.fromJson(json["data"]),
errors: json["errors"],
);
Map<String, dynamic> toJson() => {
"isSuccess": isSuccess,
"statusCode": statusCode,
"message": message,
"data": data?.toJson(),
"errors": errors,
};
}
class SingelPostData {
int? postId;
String? userId;
String? firstName;
String? lastName;
String? fullName;
String? profilePicture;
int? userTypeId;
String? userTypeName;
String? coachTypeName;
int? coachRequestStatus;
String? content;
int? postTypeId;
int? postVisibilityId;
int? deviceTypeId;
bool? isTribe;
dynamic tribeId;
DateTime? createdAt;
DateTime? updateAt;
List<dynamic>? mediaFiles;
dynamic poll;
List<SinglePostComment>? comments;
int? totalPostComments;
int? totalPostReactions;
dynamic postReactionTypeId;
SingelPostData({
this.postId,
this.userId,
this.firstName,
this.lastName,
this.fullName,
this.profilePicture,
this.userTypeId,
this.userTypeName,
this.coachTypeName,
this.coachRequestStatus,
this.content,
this.postTypeId,
this.postVisibilityId,
this.deviceTypeId,
this.isTribe,
this.tribeId,
this.createdAt,
this.updateAt,
this.mediaFiles,
this.poll,
this.comments,
this.totalPostComments,
this.totalPostReactions,
this.postReactionTypeId,
});
factory SingelPostData.fromJson(Map<String, dynamic> json) => SingelPostData(
postId: json["postID"],
userId: json["userID"],
firstName: json["firstName"],
lastName: json["lastName"],
fullName: json["fullName"],
profilePicture: json["profilePicture"],
userTypeId: json["userTypeId"],
userTypeName: json["userTypeName"],
coachTypeName: json["coachTypeName"],
coachRequestStatus: json["coachRequestStatus"],
content: json["content"],
postTypeId: json["postTypeID"],
postVisibilityId: json["postVisibilityID"],
deviceTypeId: json["deviceTypeID"],
isTribe: json["isTribe"],
tribeId: json["tribeID"],
createdAt:
json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]),
updateAt:
json["updateAt"] == null ? null : DateTime.parse(json["updateAt"]),
mediaFiles:
json["mediaFiles"] == null
? []
: List<dynamic>.from(json["mediaFiles"]!.map((x) => x)),
poll: json["poll"],
comments:
json["comments"] == null
? []
: List<SinglePostComment>.from(
json["comments"]!.map((x) => SinglePostComment.fromJson(x)),
),
totalPostComments: json["totalPostComments"],
totalPostReactions: json["totalPostReactions"],
postReactionTypeId: json["postReactionTypeID"],
);
Map<String, dynamic> toJson() => {
"postID": postId,
"userID": userId,
"firstName": firstName,
"lastName": lastName,
"fullName": fullName,
"profilePicture": profilePicture,
"userTypeId": userTypeId,
"userTypeName": userTypeName,
"coachTypeName": coachTypeName,
"coachRequestStatus": coachRequestStatus,
"content": content,
"postTypeID": postTypeId,
"postVisibilityID": postVisibilityId,
"deviceTypeID": deviceTypeId,
"isTribe": isTribe,
"tribeID": tribeId,
"createdAt": createdAt?.toIso8601String(),
"updateAt": updateAt?.toIso8601String(),
"mediaFiles":
mediaFiles == null ? [] : List<dynamic>.from(mediaFiles!.map((x) => x)),
"poll": poll,
"comments":
comments == null
? []
: List<dynamic>.from(comments!.map((x) => x.toJson())),
"totalPostComments": totalPostComments,
"totalPostReactions": totalPostReactions,
"postReactionTypeID": postReactionTypeId,
};
}
class SinglePostComment {
int? commentId;
int? postId;
String? userId;
String? firstName;
String? lastName;
String? fullName;
String? profilePicture;
dynamic parentCommentId;
String? commentText;
DateTime? createdAt;
DateTime? updatedAt;
SinglePostComment? subComment;
int? remainingSubCommentCount;
SinglePostComment({
this.commentId,
this.postId,
this.userId,
this.firstName,
this.lastName,
this.fullName,
this.profilePicture,
this.parentCommentId,
this.commentText,
this.createdAt,
this.updatedAt,
this.subComment,
this.remainingSubCommentCount,
});
factory SinglePostComment.fromJson(
Map<String, dynamic> json,
) => SinglePostComment(
commentId: json["commentID"],
postId: json["postID"],
userId: json["userID"],
firstName: json["firstName"],
lastName: json["lastName"],
fullName: json["fullName"],
profilePicture: json["profilePicture"],
parentCommentId: json["parentCommentID"],
commentText: json["commentText"],
createdAt:
json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]),
updatedAt:
json["updatedAt"] == null ? null : DateTime.parse(json["updatedAt"]),
subComment:
json["subComment"] == null
? null
: SinglePostComment.fromJson(json["subComment"]),
remainingSubCommentCount: json["remainingSubCommentCount"],
);
Map<String, dynamic> toJson() => {
"commentID": commentId,
"postID": postId,
"userID": userId,
"firstName": firstName,
"lastName": lastName,
"fullName": fullName,
"profilePicture": profilePicture,
"parentCommentID": parentCommentId,
"commentText": commentText,
"createdAt": createdAt?.toIso8601String(),
"updatedAt": updatedAt?.toIso8601String(),
"subComment": subComment?.toJson(),
"remainingSubCommentCount": remainingSubCommentCount,
};
}