Files
Regroup/lib/Main_Screens/Community/Model/CommonDatumObjModel.dart
2024-08-13 17:43:42 +05:30

252 lines
6.5 KiB
Dart

class CommonDatumObjModel {
CommonDatumObjModel({
required this.status,
required this.statusCode,
required this.message,
required this.data,
});
final String? status;
final int? statusCode;
final String? message;
final List<CommonDatumObjModelData> data;
factory CommonDatumObjModel.fromJson(Map<String, dynamic> json) {
return CommonDatumObjModel(
status: json["status"],
statusCode: json["status_code"],
message: json["message"],
data: json["data"] == null
? []
: List<CommonDatumObjModelData>.from(
json["data"]!.map((x) => CommonDatumObjModelData.fromJson(x))),
);
}
}
class CommonDatumObjModelData {
CommonDatumObjModelData({
required this.id,
required this.likecount,
required this.isISaved,
required this.tagsXid,
required this.isILiked,
required this.totalComment,
required this.totalSave,
required this.iamPrincipalXid,
required this.postIn,
required this.caption,
required this.image,
required this.manageTagsXids,
required this.postAs,
required this.ctaTitle,
required this.ctaLink,
required this.createdAt,
required this.likeIcon,
required this.totalViewCount,
required this.totalReactionCount,
required this.totalCommentCount,
required this.totalImpressionCount,
required this.totalPopularScore,
required this.totalHoursAgo,
required this.iamPrincipal,
required this.community,
required this.attachTags,
});
final int? id;
final int? likecount;
final bool? isISaved;
final List<int> tagsXid;
final bool? isILiked;
final int? totalComment;
final int? totalSave;
final int? iamPrincipalXid;
final int? postIn;
final String? caption;
final String? image;
final String? manageTagsXids;
final String? postAs;
final String? ctaTitle;
final String? ctaLink;
final DateTime? createdAt;
final LikeIcon1? likeIcon;
final int? totalViewCount;
final int? totalReactionCount;
final int? totalCommentCount;
final int? totalImpressionCount;
final int? totalPopularScore;
final int? totalHoursAgo;
final IamPrincipal? iamPrincipal;
final Community? community;
final List<AttachTag1> attachTags;
factory CommonDatumObjModelData.fromJson(Map<String, dynamic> json) {
return CommonDatumObjModelData(
id: json["id"],
likecount: json["likecount"],
isISaved: json["is_i_saved"],
tagsXid: json["tags_xid"] == null
? []
: List<int>.from(json["tags_xid"]!.map((x) => x)),
isILiked: json["is_i_liked"],
totalComment: json["total_comment"],
totalSave: json["total_save"],
iamPrincipalXid: json["iam_principal_xid"],
postIn: json["post_in"],
caption: json["caption"],
image: json["image"],
manageTagsXids: json["manage_tags_xids"],
postAs: json["post_as"],
ctaTitle: json["cta_title"],
ctaLink: json["cta_link"],
createdAt: DateTime.tryParse(json["created_at"] ?? ""),
likeIcon:
json["likeIcon"] == null ? null : LikeIcon1.fromJson(json["likeIcon"]),
totalViewCount: json["totalViewCount"],
totalReactionCount: json["totalReactionCount"],
totalCommentCount: json["totalCommentCount"],
totalImpressionCount: json["totalImpressionCount"],
totalPopularScore: json["totalPopularScore"],
totalHoursAgo: json["totalHoursAgo"],
iamPrincipal: json["iam_principal"] == null
? null
: IamPrincipal.fromJson(json["iam_principal"]),
community: json["community"] == null
? null
: Community.fromJson(json["community"]),
attachTags: json["attach_tags"] == null
? []
: List<AttachTag1>.from(
json["attach_tags"]!.map((x) => AttachTag1.fromJson(x))),
);
}
}
class AttachTag1 {
AttachTag1({
required this.managePostXid,
required this.manageTagXid,
required this.manageTag,
});
final int? managePostXid;
final int? manageTagXid;
final ManageTagPopular? manageTag;
factory AttachTag1.fromJson(Map<String, dynamic> json) {
return AttachTag1(
managePostXid: json["manage_post_xid"],
manageTagXid: json["manage_tag_xid"],
manageTag: json["manage_tag"] == null
? null
: ManageTagPopular.fromJson(json["manage_tag"]),
);
}
}
class ManageTagPopular {
ManageTagPopular({
required this.id,
required this.isPinned,
required this.name,
});
final int? id;
final bool? isPinned;
final String? name;
factory ManageTagPopular.fromJson(Map<String, dynamic> json) {
return ManageTagPopular(
id: json["id"],
isPinned: json["is_pinned"],
name: json["name"],
);
}
}
class Community {
Community({
required this.id,
required this.communityProfilePhoto,
required this.communityName,
});
final int? id;
final String? communityProfilePhoto;
final String? communityName;
factory Community.fromJson(Map<String, dynamic> json) {
return Community(
id: json["id"],
communityProfilePhoto: json["community_profile_photo"],
communityName: json["community_name"],
);
}
}
class IamPrincipal {
IamPrincipal({
required this.id,
required this.isUserPinned,
required this.principalTypeXid,
required this.userName,
required this.fullName,
required this.profilePhoto,
});
final int? id;
final bool? isUserPinned;
final int? principalTypeXid;
final String? userName;
final String? fullName;
final String? profilePhoto;
factory IamPrincipal.fromJson(Map<String, dynamic> json) {
return IamPrincipal(
id: json["id"],
isUserPinned: json["is_user_pinned"],
principalTypeXid: json["principal_type_xid"],
userName: json["user_name"],
fullName: json["full_name"],
profilePhoto: json["profile_photo"],
);
}
}
class LikeIcon1 {
LikeIcon1({
required this.likeIconsXid,
required this.likeIcon,
});
final int? likeIconsXid;
final LikeIconClass1? likeIcon;
factory LikeIcon1.fromJson(Map<String, dynamic> json) {
return LikeIcon1(
likeIconsXid: json["like_icons_xid"],
likeIcon: json["like_icon"] == null
? null
: LikeIconClass1.fromJson(json["like_icon"]),
);
}
}
class LikeIconClass1 {
LikeIconClass1({
required this.id,
required this.image,
});
final int? id;
final String? image;
factory LikeIconClass1.fromJson(Map<String, dynamic> json) {
return LikeIconClass1(
id: json["id"],
image: json["image"],
);
}
}