295 lines
6.4 KiB
Dart

// ignore_for_file: unnecessary_this
class GasModel {
int? id;
String? name;
Location? location;
Contact? contact;
List<OpeningHours>? openingHours;
OfferInformation? offerInformation;
PaymentMethods? paymentMethods;
PaymentArrangements? paymentArrangements;
int? position;
bool? open;
double? distance;
List<Prices>? prices;
GasModel(
{int? id,
String? name,
Location? location,
Contact? contact,
List<OpeningHours>? openingHours,
OfferInformation? offerInformation,
PaymentMethods? paymentMethods,
PaymentArrangements? paymentArrangements,
int? position,
bool? open,
double? distance,
List<Prices>? prices}) {
if (id != null) {
this.id = id;
}
if (name != null) {
this.name = name;
}
if (location != null) {
this.location = location;
}
if (contact != null) {
this.contact = contact;
}
if (openingHours != null) {
this.openingHours = openingHours;
}
if (offerInformation != null) {
this.offerInformation = offerInformation;
}
if (paymentMethods != null) {
this.paymentMethods = paymentMethods;
}
if (paymentArrangements != null) {
this.paymentArrangements = paymentArrangements;
}
if (position != null) {
this.position = position;
if (open != null) {
this.open = open;
}
if (distance != null) {
this.distance = distance;
}
if (prices != null) {
this.prices = prices;
}
}
}
GasModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
location =
json['location'] != null ? Location.fromJson(json['location']) : null;
contact =
json['contact'] != null ? Contact.fromJson(json['contact']) : null;
if (json['openingHours'] != null) {
openingHours = <OpeningHours>[];
json['openingHours'].forEach((v) {
openingHours!.add(OpeningHours.fromJson(v));
});
}
offerInformation = json['offerInformation'] != null
? OfferInformation.fromJson(json['offerInformation'])
: null;
paymentMethods = json['paymentMethods'] != null
? PaymentMethods.fromJson(json['paymentMethods'])
: null;
paymentArrangements = json['paymentArrangements'] != null
? PaymentArrangements.fromJson(json['paymentArrangements'])
: null;
position = json['position'];
open = json['open'];
distance = json['distance'];
if (json['prices'] != null) {
prices = <Prices>[];
json['prices'].forEach((v) {
prices!.add(Prices.fromJson(v));
});
}
}
}
class Location {
String? address;
String? postalCode;
String? city;
double? latitude;
double? longitude;
Location(
{String? address,
String? postalCode,
String? city,
double? latitude,
double? longitude}) {
if (address != null) {
this.address = address;
}
if (postalCode != null) {
this.postalCode = postalCode;
}
if (city != null) {
this.city = city;
}
if (latitude != null) {
this.latitude = latitude;
}
if (longitude != null) {
this.longitude = longitude;
}
}
Location.fromJson(Map<String, dynamic> json) {
address = json['address'];
postalCode = json['postalCode'];
city = json['city'];
latitude = json['latitude'];
longitude = json['longitude'];
}
}
class Contact {
String? telephone;
String? website;
Contact({String? telephone, String? website}) {
if (telephone != null) {
this.telephone = telephone;
}
if (website != null) {
this.website = website;
}
}
Contact.fromJson(Map<String, dynamic> json) {
telephone = json['telephone'];
website = json['website'];
}
}
class OpeningHours {
String? day;
String? label;
int? order;
String? from;
String? to;
OpeningHours(
{String? day, String? label, int? order, String? from, String? to}) {
if (day != null) {
this.day = day;
}
if (label != null) {
this.label = label;
}
if (order != null) {
this.order = order;
}
if (from != null) {
this.from = from;
}
if (to != null) {
this.to = to;
}
}
OpeningHours.fromJson(Map<String, dynamic> json) {
day = json['day'];
label = json['label'];
order = json['order'];
from = json['from'];
to = json['to'];
}
}
class OfferInformation {
bool? service;
bool? selfService;
bool? unattended;
OfferInformation({bool? service, bool? selfService, bool? unattended}) {
if (service != null) {
this.service = service;
}
if (selfService != null) {
this.selfService = selfService;
}
if (unattended != null) {
this.unattended = unattended;
}
}
OfferInformation.fromJson(Map<String, dynamic> json) {
service = json['service'];
selfService = json['selfService'];
unattended = json['unattended'];
}
}
class PaymentMethods {
bool? cash;
bool? debitCard;
bool? creditCard;
String? others;
PaymentMethods( {bool? cash, bool? debitCard, bool? creditCard, String? others}) {
if (cash != null) {
this.cash = cash;
}
if (debitCard != null) {
this.debitCard = debitCard;
}
if (creditCard != null) {
this.creditCard = creditCard;
}
if (others != null) {
this.others = others;
}
}
PaymentMethods.fromJson(Map<String, dynamic> json) {
cash = json['cash'];
debitCard = json['debitCard'];
creditCard = json['creditCard'];
others = json['others'];
}
}
class PaymentArrangements {
bool? cooperative;
bool? clubCard;
PaymentArrangements({bool? cooperative, bool? clubCard}) {
if (cooperative != null) {
this.cooperative = cooperative;
}
if (clubCard != null) {
this.clubCard = clubCard;
}
}
PaymentArrangements.fromJson(Map<String, dynamic> json) {
cooperative = json['cooperative'];
clubCard = json['clubCard'];
}
}
class Prices {
String? fuelType;
double? amount;
String? label;
Prices({String? fuelType, double? amount, String? label}) {
if (fuelType != null) {
this.fuelType = fuelType;
}
if (amount != null) {
this.amount = amount;
}
if (label != null) {
this.label = label;
}
}
Prices.fromJson(Map<String, dynamic> json) {
fuelType = json['fuelType'];
amount = json['amount'];
label = json['label'];
}
}