onufitness_mobile/lib/screens/accounts/model/coach_rating_response_model.dart
2026-01-13 11:36:24 +05:30

143 lines
3.7 KiB
Dart

import 'dart:convert';
CoachRatingsResponseModel coachRatingsResponseModelFromJson(String str) =>
CoachRatingsResponseModel.fromJson(json.decode(str));
String coachRatingsResponseModelToJson(CoachRatingsResponseModel data) =>
json.encode(data.toJson());
class CoachRatingsResponseModel {
bool? isSuccess;
int? statusCode;
String? message;
Data? data;
dynamic errors;
CoachRatingsResponseModel({
this.isSuccess,
this.statusCode,
this.message,
this.data,
this.errors,
});
factory CoachRatingsResponseModel.fromJson(Map<String, dynamic> json) =>
CoachRatingsResponseModel(
isSuccess: json["isSuccess"],
statusCode: json["statusCode"],
message: json["message"],
data: json["data"] == null ? null : Data.fromJson(json["data"]),
errors: json["errors"],
);
Map<String, dynamic> toJson() => {
"isSuccess": isSuccess,
"statusCode": statusCode,
"message": message,
"data": data?.toJson(),
"errors": errors,
};
}
class Data {
List<CoachReviewRating>? userReviewRatings;
double? userAvgReviewRating;
int? totalReviews;
int? countOf5Star;
int? countOf4Star;
int? countOf3Star;
int? countOf2Star;
int? countOf1Star;
Data({
this.userReviewRatings,
this.userAvgReviewRating,
this.totalReviews,
this.countOf5Star,
this.countOf4Star,
this.countOf3Star,
this.countOf2Star,
this.countOf1Star,
});
factory Data.fromJson(Map<String, dynamic> json) => Data(
userReviewRatings:
json["userReviewRatings"] == null
? []
: List<CoachReviewRating>.from(
json["userReviewRatings"]!.map(
(x) => CoachReviewRating.fromJson(x),
),
),
userAvgReviewRating: json["userAvgReviewRating"]?.toDouble(),
totalReviews: json["totalReviews"],
countOf5Star: json["countOf5Star"],
countOf4Star: json["countOf4Star"],
countOf3Star: json["countOf3Star"],
countOf2Star: json["countOf2Star"],
countOf1Star: json["countOf1Star"],
);
Map<String, dynamic> toJson() => {
"userReviewRatings":
userReviewRatings == null
? []
: List<dynamic>.from(userReviewRatings!.map((x) => x.toJson())),
"userAvgReviewRating": userAvgReviewRating,
"totalReviews": totalReviews,
"countOf5Star": countOf5Star,
"countOf4Star": countOf4Star,
"countOf3Star": countOf3Star,
"countOf2Star": countOf2Star,
"countOf1Star": countOf1Star,
};
}
class CoachReviewRating {
String? userId;
String? firstName;
String? lastName;
String? fullName;
String? profilePicture;
int? rating;
String? reviewDescription;
DateTime? createdAt;
CoachReviewRating({
this.userId,
this.firstName,
this.lastName,
this.fullName,
this.profilePicture,
this.rating,
this.reviewDescription,
this.createdAt,
});
factory CoachReviewRating.fromJson(Map<String, dynamic> json) =>
CoachReviewRating(
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(),
};
}