import 'package:prosapp_web_app/models/pro_state.dart'; class Usuario { final String id; final String? email; final String? phone; final String name; final String? nickname; final String? city; final String? picture; final String? birthday; final String? gender; final ProState proState; final String? token; final bool isPhoneVerified; Usuario({ required this.id, required this.email, required this.phone, required this.name, required this.nickname, required this.city, required this.picture, required this.birthday, required this.gender, required this.proState, required this.token, this.isPhoneVerified = false, }); Map toDocument() { return { 'id': id, 'email': email, 'phone': phone, 'name': name, 'nickname': name.toLowerCase().trim().replaceAll(' ', '_'), 'city': city, 'picture': picture, 'birthday': birthday, 'gender': gender, 'professional_state': enumToInt(proState), 'token': token, }; } static Usuario fromDocument(Map doc) { return Usuario( id: (doc['id'] as String?) ?? '', email: doc['email'], phone: doc['phone'], name: doc['name'] ?? '', nickname: doc['nickname'], city: doc['city'], picture: doc['picture'], birthday: doc['birthday'], gender: doc['gender'], proState: intToEnum((doc['professional_state'] as int?) ?? 0), token: doc['token'], isPhoneVerified: doc['is_phone_verified'] as bool? ?? false, ); } @override String toString() { return 'User(id: $id, email: $email, phone: $phone, name: $name, nickname: $nickname, city: $city, picture: $picture, birthday: $birthday, gender: $gender, proState: $proState, token: $token)'; } }