Files
prosappweb/lib/models/profesional.dart
T
Lizandro GuarnizoandClaude Sonnet 4.6 15175c1b91 replace: swap prosappweb content for prosapp_web_app (more complete version)
prosapp_web_app has chat, dashboard, calendar, support, 13 providers and
Fluro URL routing. Keep Dockerfile + nginx.conf from previous prosappweb.
Upgrade google_fonts 6.2.1 → 8.1.0 (Dart 3.12 compat fix).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 15:26:32 -05:00

154 lines
5.3 KiB
Dart

import 'package:prosapp_web_app/models/location_preferences.dart';
import 'package:prosapp_web_app/models/payment_method_entity.dart';
import 'package:prosapp_web_app/models/schedules.dart';
class Profesional {
final String id;
final String identification;
final String address;
final String aditionalAddress;
final String profession;
final bool ratePreferences;
final String rate;
final LocationPreferences locationPreferences;
final String bannerPicture;
final String identificationPicture;
final String certificatePicture;
final double latitude;
final double longitude;
final List<String> specializations;
final List<String> specializationsPictures;
final Schedules schedules;
final PaymentMethodEntity paymentMethods;
const Profesional({
required this.id,
required this.identification,
required this.address,
required this.aditionalAddress,
required this.profession,
required this.ratePreferences,
required this.rate,
required this.locationPreferences,
required this.bannerPicture,
required this.identificationPicture,
required this.certificatePicture,
required this.latitude,
required this.longitude,
required this.specializations,
required this.specializationsPictures,
required this.schedules,
required this.paymentMethods,
});
static Profesional fromDocument(Map<String, dynamic> doc) {
return Profesional(
id: doc['id'] as String,
identification: doc['identification'] as String,
address: doc['address'] as String,
aditionalAddress: doc['aditional_address'] as String,
profession: doc['profession'] as String,
ratePreferences: doc['rate_preferences'] as bool,
rate: doc['rate'] as String,
locationPreferences: intToEnum(doc['location_preferences'] as int),
bannerPicture: doc['banner_picture'] as String,
identificationPicture: doc['identification_picture'] as String,
certificatePicture: doc['certificate_picture'] as String,
latitude: double.parse(doc['latitude'].toString()),
longitude: double.parse(doc['longitude'].toString()),
specializations: List<String>.from(doc['specializations']),
specializationsPictures:
List<String>.from(doc['specializations_pictures']),
schedules: Schedules.fromDocument(doc['schedules']),
paymentMethods: PaymentMethodEntity.fromDocument(doc['payment_methods']),
);
}
Profesional copyWith({
String? id,
String? identification,
String? address,
String? aditionalAddress,
String? profession,
bool ratePreferences = false,
String? rate,
LocationPreferences? locationPreferences,
String? bannerPicture,
String? identificationPicture,
String? certificatePicture,
double? latitude,
double? longitude,
List<String>? specializations,
List<String>? specializationsPictures,
Schedules? schedules,
PaymentMethodEntity? paymentMethods,
}) {
return Profesional(
id: id ?? this.id,
identification: identification ?? this.identification,
address: address ?? this.address,
aditionalAddress: aditionalAddress ?? this.aditionalAddress,
profession: profession ?? this.profession,
ratePreferences: ratePreferences,
rate: rate ?? this.rate,
locationPreferences: locationPreferences ?? this.locationPreferences,
bannerPicture: bannerPicture ?? this.bannerPicture,
identificationPicture:
identificationPicture ?? this.identificationPicture,
certificatePicture: certificatePicture ?? this.certificatePicture,
latitude: latitude ?? this.latitude,
longitude: longitude ?? this.longitude,
specializations: specializations ?? this.specializations,
specializationsPictures:
specializationsPictures ?? this.specializationsPictures,
schedules: schedules ?? this.schedules,
paymentMethods: paymentMethods ?? this.paymentMethods,
);
}
Map<String, dynamic> toDocument() {
return {
'id': id,
'identification': identification,
'address': address,
'aditional_address': aditionalAddress,
'profession': profession,
'rate_preferences': ratePreferences,
'rate': rate,
'location_preferences': enumToInt(locationPreferences),
'banner_picture': bannerPicture,
'identification_picture': identificationPicture,
'certificate_picture': certificatePicture,
'latitude': latitude,
'longitude': longitude,
'specializations': specializations,
'specializations_pictures': specializationsPictures,
'schedules': schedules.toJson(),
'payment_methods': paymentMethods.toDocument(),
};
}
@override
String toString() {
return '''Profesional{ {
id: $id,
identification: $identification,
address: $address,
aditional_address: $aditionalAddress,
profession: $profession,
rate_preferences: $ratePreferences,
rate: $rate,
location_preferences: $locationPreferences,
bannerPicture: $bannerPicture,
identificationPicture: $identificationPicture,
certificatePicture: $certificatePicture,
latitude: $latitude,
longitude: $longitude,
specializations: $specializations,
specializationsPictures: $specializationsPictures,
schedule: $schedules,
paymentMethods: $paymentMethods
}''';
}
}