51 lines
1.3 KiB
Dart
51 lines
1.3 KiB
Dart
class CrecheSettings {
|
|
final int id;
|
|
final String name;
|
|
final String? logoUrl;
|
|
final String? address;
|
|
final String slogan;
|
|
final List<String> allowedIps;
|
|
final double? geofenceLat;
|
|
final double? geofenceLng;
|
|
final int geofenceRadiusMeters;
|
|
|
|
CrecheSettings({
|
|
required this.id,
|
|
required this.name,
|
|
this.logoUrl,
|
|
this.address,
|
|
required this.slogan,
|
|
required this.allowedIps,
|
|
this.geofenceLat,
|
|
this.geofenceLng,
|
|
required this.geofenceRadiusMeters,
|
|
});
|
|
|
|
factory CrecheSettings.fromMap(Map<String, dynamic> map) {
|
|
return CrecheSettings(
|
|
id: map['id'] ?? 1,
|
|
name: map['name'] ?? 'Creche e Berçário Sementes do Futuro',
|
|
logoUrl: map['logo_url'],
|
|
address: map['address'],
|
|
slogan: map['slogan'] ?? 'Conforto, cuidado e aprendizagem',
|
|
allowedIps: List<String>.from(map['allowed_ips'] ?? []),
|
|
geofenceLat: map['geofence_lat']?.toDouble(),
|
|
geofenceLng: map['geofence_lng']?.toDouble(),
|
|
geofenceRadiusMeters: map['geofence_radius_meters'] ?? 150,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'name': name,
|
|
'logo_url': logoUrl,
|
|
'address': address,
|
|
'slogan': slogan,
|
|
'allowed_ips': allowedIps,
|
|
'geofence_lat': geofenceLat,
|
|
'geofence_lng': geofenceLng,
|
|
'geofence_radius_meters': geofenceRadiusMeters,
|
|
};
|
|
}
|
|
}
|