48 lines
1.1 KiB
Dart
48 lines
1.1 KiB
Dart
import 'package:taafee_mobile/features/card/data_layer/model/appointment.dart';
|
|
|
|
class User {
|
|
int id;
|
|
String firstName;
|
|
String lastName;
|
|
String email;
|
|
int chatUserId;
|
|
String? avatarImage;
|
|
List<Appointment>? appointments;
|
|
User({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.email,
|
|
required this.avatarImage,
|
|
required this.chatUserId,
|
|
this.appointments,
|
|
});
|
|
|
|
factory User.fromJson(Map<String, dynamic> json) => User(
|
|
id: json["id"],
|
|
firstName: json["first_name"],
|
|
lastName: json["last_name"],
|
|
email: json["email"],
|
|
avatarImage: json['avatar'],
|
|
chatUserId: json["chat_user_id"] ?? 0,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"first_name": firstName,
|
|
"last_name": lastName,
|
|
"email": email,
|
|
"avatar": avatarImage,
|
|
"chat_user_id": chatUserId,
|
|
};
|
|
|
|
factory User.zero() => User(
|
|
id: 0,
|
|
firstName: "",
|
|
lastName: "",
|
|
email: "",
|
|
avatarImage: null,
|
|
chatUserId: 0,
|
|
);
|
|
}
|