import 'package:muaawana/models/categories/image.dart'; import '../commun/Role.dart'; import 'Service_rating.dart'; import 'Technician.dart'; class User { User({ this.active, this.birthDate, this.city, this.email, this.gender, this.id, this.image, this.name, this.phonenumber, this.role, this.secondNumber, this.servicesRatings, this.technician, this.timestmp, this.username,}); User.fromJson(dynamic json) { active = json['active']; birthDate = json['birthDate']; city = json['city']; email = json['email']; gender = json['gender']; id = json['id']; image = json['image'] != null ? Image.fromJson(json['image']) : null; name = json['name']; phonenumber = json['phonenumber']; role = json['role'] != null ? Role.fromJson(json['role']) : null; secondNumber = json['secondNumber']; if (json['servicesRatings'] != null) { servicesRatings = []; json['servicesRatings'].forEach((v) { servicesRatings?.add(ServiceRating.fromJson(v)); }); } technician = json['technician'] != null ? Technician.fromJson(json['technician']) : null; timestmp = json['timestmp']; username = json['username']; } bool? active; int? birthDate; String? city; String? email; String? gender; int? id; Image? image; String? name; String? phonenumber; Role? role; String? secondNumber; List? servicesRatings; Technician? technician; int? timestmp; String? username; Map toJson() { final map = {}; map['active'] = active; map['birthDate'] = birthDate; map['city'] = city; map['email'] = email; map['gender'] = gender; map['id'] = id; if (image != null) { map['image'] = image?.toJson(); } map['name'] = name; map['phonenumber'] = phonenumber; if (role != null) { map['role'] = role?.toJson(); } map['secondNumber'] = secondNumber; if (servicesRatings != null) { map['servicesRatings'] = servicesRatings?.map((v) => v.toJson()).toList(); } if (technician != null) { map['technician'] = technician?.toJson(); } map['timestmp'] = timestmp; map['username'] = username; return map; } }