web_flutter_tank_appwrite_app/lib/models/ptv_logistic_model.dart
2025-10-22 08:43:20 +02:00

168 lines
4.2 KiB
Dart

/// Hauptklasse für die PTV Location Response
class PTVModel {
List<Locations>? locations;
String? noMatchFeedbackId;
PTVModel({this.locations, this.noMatchFeedbackId});
PTVModel.fromJson(Map<String, dynamic> json) {
if (json['locations'] != null) {
locations = <Locations>[];
json['locations'].forEach((v) {
locations!.add(Locations.fromJson(v));
});
}
noMatchFeedbackId = json['noMatchFeedbackId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (locations != null) {
data['locations'] = locations!.map((v) => v.toJson()).toList();
}
data['noMatchFeedbackId'] = noMatchFeedbackId;
return data;
}
}
class Locations {
ReferencePosition? referencePosition;
Address? address;
String? locationType;
Quality? quality;
String? formattedAddress;
String? feedbackId;
Locations(
{this.referencePosition,
this.address,
this.locationType,
this.quality,
this.formattedAddress,
this.feedbackId});
Locations.fromJson(Map<String, dynamic> json) {
referencePosition = json['referencePosition'] != null
? ReferencePosition.fromJson(json['referencePosition'])
: null;
address =
json['address'] != null ? Address.fromJson(json['address']) : null;
locationType = json['locationType'];
quality =
json['quality'] != null ? Quality.fromJson(json['quality']) : null;
formattedAddress = json['formattedAddress'];
feedbackId = json['feedbackId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (referencePosition != null) {
data['referencePosition'] = referencePosition!.toJson();
}
if (address != null) {
data['address'] = address!.toJson();
}
data['locationType'] = locationType;
if (quality != null) {
data['quality'] = quality!.toJson();
}
data['formattedAddress'] = formattedAddress;
data['feedbackId'] = feedbackId;
return data;
}
}
class ReferencePosition {
double? latitude;
double? longitude;
ReferencePosition({this.latitude, this.longitude});
ReferencePosition.fromJson(Map<String, dynamic> json) {
latitude = json['latitude'];
longitude = json['longitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['latitude'] = latitude;
data['longitude'] = longitude;
return data;
}
}
class Address {
String? countryName;
String? state;
String? province;
String? city;
String? district;
String? subdistrict;
String? street;
String? houseNumber;
String? countryCodeIsoAlpha2;
String? countryCodeIsoAlpha3;
String? countryCode;
Address(
{this.countryName,
this.state,
this.province,
this.city,
this.district,
this.subdistrict,
this.street,
this.houseNumber,
this.countryCodeIsoAlpha2,
this.countryCodeIsoAlpha3,
this.countryCode});
Address.fromJson(Map<String, dynamic> json) {
countryName = json['countryName'];
state = json['state'];
province = json['province'];
city = json['city'];
district = json['district'];
subdistrict = json['subdistrict'];
street = json['street'];
houseNumber = json['houseNumber'];
countryCodeIsoAlpha2 = json['countryCodeIsoAlpha2'];
countryCodeIsoAlpha3 = json['countryCodeIsoAlpha3'];
countryCode = json['countryCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['countryName'] = countryName;
data['state'] = state;
data['province'] = province;
data['city'] = city;
data['district'] = district;
data['subdistrict'] = subdistrict;
data['street'] = street;
data['houseNumber'] = houseNumber;
data['countryCodeIsoAlpha2'] = countryCodeIsoAlpha2;
data['countryCodeIsoAlpha3'] = countryCodeIsoAlpha3;
data['countryCode'] = countryCode;
return data;
}
}
class Quality {
int? distance;
Quality({this.distance});
Quality.fromJson(Map<String, dynamic> json) {
distance = json['distance'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['distance'] = distance;
return data;
}
}