// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'tour.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

Article _$ArticleFromJson(Map<String, dynamic> json) => Article(
  id: (json['id'] as num).toInt(),
  title: json['title'] as String,
  quantity: (json['quantity'] as num).toInt(),
  pricePerQuantity: (json['price_per_quantity'] as num).toDouble(),
  depositPricePerQuantity: (json['deposit_price_per_quantity'] as num)
      .toDouble(),
  quantityDelivered: (json['quantity_delivered'] as num).toInt(),
  quantityReturned: (json['quantity_returned'] as num).toInt(),
  quantityToDeposit: (json['quantity_to_deposit'] as num).toInt(),
  referenceTo: (json['reference_to'] as num?)?.toInt(),
);

Map<String, dynamic> _$ArticleToJson(Article instance) => <String, dynamic>{
  'id': instance.id,
  'title': instance.title,
  'quantity': instance.quantity,
  'price_per_quantity': instance.pricePerQuantity,
  'deposit_price_per_quantity': instance.depositPricePerQuantity,
  'quantity_delivered': instance.quantityDelivered,
  'quantity_returned': instance.quantityReturned,
  'quantity_to_deposit': instance.quantityToDeposit,
  'reference_to': instance.referenceTo,
};

Address _$AddressFromJson(Map<String, dynamic> json) => Address(
  street: json['street'] as String,
  housingNumber: json['housing_number'] as String,
  postalCode: json['postal_code'] as String,
  city: json['city'] as String,
  country: json['country'] as String?,
);

Map<String, dynamic> _$AddressToJson(Address instance) => <String, dynamic>{
  'street': instance.street,
  'housing_number': instance.housingNumber,
  'postal_code': instance.postalCode,
  'city': instance.city,
  'country': instance.country,
};

Customer _$CustomerFromJson(Map<String, dynamic> json) => Customer(
  name: json['name'] as String,
  id: (json['id'] as num).toInt(),
  address: Address.fromJson(json['address'] as Map<String, dynamic>),
);

Map<String, dynamic> _$CustomerToJson(Customer instance) => <String, dynamic>{
  'name': instance.name,
  'id': instance.id,
  'address': instance.address,
};

Receipt _$ReceiptFromJson(Map<String, dynamic> json) => Receipt(
  articles: (json['articles'] as List<dynamic>)
      .map((e) => Article.fromJson(e as Map<String, dynamic>))
      .toList(),
  customer: Customer.fromJson(json['customer'] as Map<String, dynamic>),
  totalGrossPrice: (json['total_gross_price'] as num).toDouble(),
  totalNetPrice: (json['total_net_price'] as num).toDouble(),
);

Map<String, dynamic> _$ReceiptToJson(Receipt instance) => <String, dynamic>{
  'articles': instance.articles,
  'customer': instance.customer,
  'total_gross_price': instance.totalGrossPrice,
  'total_net_price': instance.totalNetPrice,
};

Delivery _$DeliveryFromJson(Map<String, dynamic> json) => Delivery(
  receipt: Receipt.fromJson(json['receipt'] as Map<String, dynamic>),
  informationForDriver: json['information_for_driver'] as String,
  desiredDeliveryTime: DateTime.parse(json['desired_delivery_time'] as String),
  timeDelivered: json['time_delivered'] == null
      ? null
      : DateTime.parse(json['time_delivered'] as String),
);

Map<String, dynamic> _$DeliveryToJson(Delivery instance) => <String, dynamic>{
  'receipt': instance.receipt,
  'information_for_driver': instance.informationForDriver,
  'desired_delivery_time': instance.desiredDeliveryTime.toIso8601String(),
  'time_delivered': instance.timeDelivered?.toIso8601String(),
};

Tour _$TourFromJson(Map<String, dynamic> json) => Tour(
  car: Car.fromJson(json['car'] as Map<String, dynamic>),
  date: json['date'] as String,
  deliveries: (json['deliveries'] as List<dynamic>)
      .map((e) => Delivery.fromJson(e as Map<String, dynamic>))
      .toList(),
);

Map<String, dynamic> _$TourToJson(Tour instance) => <String, dynamic>{
  'car': instance.car,
  'date': instance.date,
  'deliveries': instance.deliveries,
};
