import 'package:ftc_mobile_app/models/profileData/user_data.dart'; class TrainingResponseData { TrainingResponseData({ this.proposedTrainings, this.count, this.offset, this.limit, }); TrainingResponseData.fromJson(dynamic json) { if (json['proposedTrainings'] != null) { proposedTrainings = []; json['proposedTrainings'].forEach((v) { proposedTrainings?.add(TrainingUsers.fromJson(v)); }); } count = json['count']; offset = json['offset']; limit = json['limit']; } List? proposedTrainings; int? count; int? offset; int? limit; Map toJson() { final map = {}; if (proposedTrainings != null) { map['proposedTrainings'] = proposedTrainings?.map((v) => v.toJson()).toList(); } map['count'] = count; map['offset'] = offset; map['limit'] = limit; return map; } } class TrainingUsers { TrainingUsers({ this.id, this.user, this.trainingId, this.active, this.createdAt, this.updatedAt, }); TrainingUsers.fromJson(dynamic json) { id = json['_id']; user = json['user'] != null ? UserData.fromJson(json['user']) : null; trainingId = json['trainingId'] != null ? ProposedTrainings.fromJson(json['trainingId']) : null; active = json['active']; createdAt = json['createdAt']; updatedAt = json['updatedAt']; } String? id; UserData? user; ProposedTrainings? trainingId; bool? active; String? createdAt; String? updatedAt; Map toJson() { final map = {}; map['_id'] = id; if (user != null) { map['user'] = user?.toJson(); } if (trainingId != null) { map['trainingId'] = trainingId?.toJson(); } map['active'] = active; map['createdAt'] = createdAt; map['updatedAt'] = updatedAt; return map; } } class ProposedTrainings { ProposedTrainings({ this.id, this.prpsName, this.prpsDescription, this.prpsTrgType, this.prpsTrgClass, this.prpsTrgStatus, this.prpsTrgStartDate, this.prpsTrgEndDate, this.prpsTrgRegisterationDate, this.addedby, this.active, this.contentType, this.content, this.createdAt, this.updatedAt, // this.users, }); ProposedTrainings.fromJson(dynamic json) { id = json['_id']; prpsName = json['prpsName']; prpsDescription = json['prpsDescription']; prpsTrgType = json['prpsTrgType']; prpsTrgClass = json['prpsTrgClass']; prpsTrgStatus = json['prpsTrgStatus']; prpsTrgStartDate = json['prpsTrgStartDate']; prpsTrgEndDate = json['prpsTrgEndDate']; prpsTrgRegisterationDate = json['prpsTrgRegisterationDate']; addedby = json['addedby']; active = json['active']; contentType = json['contentType']; content = json['content'] != null ? json['content'].cast() : []; createdAt = json['createdAt']; updatedAt = json['updatedAt']; // if (json['users'] != null) { // users = []; // json['users'].forEach((v) { // users?.add(TrainingUsers.fromJson(v)); // }); // } } String? id; String? prpsName; String? prpsDescription; String? prpsTrgType; String? prpsTrgClass; String? prpsTrgStatus; int? prpsTrgStartDate; int? prpsTrgEndDate; int? prpsTrgRegisterationDate; dynamic addedby; bool? active; String? contentType; List? content; String? createdAt; String? updatedAt; // List? users; Map toJson() { final map = {}; map['_id'] = id; map['prpsName'] = prpsName; map['prpsDescription'] = prpsDescription; map['prpsTrgType'] = prpsTrgType; map['prpsTrgClass'] = prpsTrgClass; map['prpsTrgStatus'] = prpsTrgStatus; map['prpsTrgStartDate'] = prpsTrgStartDate; map['prpsTrgEndDate'] = prpsTrgEndDate; map['prpsTrgRegisterationDate'] = prpsTrgRegisterationDate; map['addedby'] = addedby; map['active'] = active; map['contentType'] = contentType; map['content'] = content; map['createdAt'] = createdAt; map['updatedAt'] = updatedAt; // if (users != null) { // map['users'] = users?.map((v) => v.toJson()).toList(); // } return map; } }