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

123 lines
3.1 KiB
Dart

import 'dart:convert';
CoachReviewsResponseModel coachReviewsResponseModelFromJson(String str) =>
CoachReviewsResponseModel.fromJson(json.decode(str));
String coachReviewsResponseModelToJson(CoachReviewsResponseModel data) =>
json.encode(data.toJson());
class CoachReviewsResponseModel {
bool? isSuccess;
int? statusCode;
String? message;
RattingData? data;
dynamic errors;
CoachReviewsResponseModel({
this.isSuccess,
this.statusCode,
this.message,
this.data,
this.errors,
});
factory CoachReviewsResponseModel.fromJson(Map<String, dynamic> json) =>
CoachReviewsResponseModel(
isSuccess: json["isSuccess"],
statusCode: json["statusCode"],
message: json["message"],
data: json["data"] == null ? null : RattingData.fromJson(json["data"]),
errors: json["errors"],
);
Map<String, dynamic> toJson() => {
"isSuccess": isSuccess,
"statusCode": statusCode,
"message": message,
"data": data?.toJson(),
"errors": errors,
};
}
class RattingData {
List<UserReviewRating>? userReviewRatings;
double? userAvgReviewRating;
int? totalReviews;
RattingData({
this.userReviewRatings,
this.userAvgReviewRating,
this.totalReviews,
});
factory RattingData.fromJson(Map<String, dynamic> json) => RattingData(
userReviewRatings:
json["userReviewRatings"] == null
? []
: List<UserReviewRating>.from(
json["userReviewRatings"]!.map(
(x) => UserReviewRating.fromJson(x),
),
),
userAvgReviewRating: json["userAvgReviewRating"]?.toDouble(),
totalReviews: json["totalReviews"],
);
Map<String, dynamic> toJson() => {
"userReviewRatings":
userReviewRatings == null
? []
: List<dynamic>.from(userReviewRatings!.map((x) => x.toJson())),
"userAvgReviewRating": userAvgReviewRating,
"totalReviews": totalReviews,
};
}
class UserReviewRating {
String? userId;
String? firstName;
String? lastName;
String? fullName;
String? profilePicture;
int? rating;
String? reviewDescription;
DateTime? createdAt;
UserReviewRating({
this.userId,
this.firstName,
this.lastName,
this.fullName,
this.profilePicture,
this.rating,
this.reviewDescription,
this.createdAt,
});
factory UserReviewRating.fromJson(Map<String, dynamic> json) =>
UserReviewRating(
userId: json["userID"],
firstName: json["firstName"],
lastName: json["lastName"],
fullName: json["fullName"],
profilePicture: json["profilePicture"],
rating: json["rating"],
reviewDescription: json["reviewDescription"],
createdAt:
json["createdAt"] == null
? null
: DateTime.parse(json["createdAt"]),
);
Map<String, dynamic> toJson() => {
"userID": userId,
"firstName": firstName,
"lastName": lastName,
"fullName": fullName,
"profilePicture": profilePicture,
"rating": rating,
"reviewDescription": reviewDescription,
"createdAt": createdAt?.toIso8601String(),
};
}