import 'package:hl_lieferservice/dto/image_note_response.dart';

import 'article.dart';
import 'contact_person.dart';
import 'customer.dart';
import 'discount.dart';
import 'note.dart';
import 'payment.dart';
import 'package:json_annotation/json_annotation.dart';

part 'delivery.g.dart';

@JsonSerializable(fieldRename: FieldRename.snake)
class DeliveryOptionDTO {
  DeliveryOptionDTO({
    required this.numerical,
    required this.value,
    required this.display,
    required this.key,
  });

  bool numerical;
  String value;
  String display;
  String key;

  factory DeliveryOptionDTO.fromJson(Map<String, dynamic> json) =>
      _$DeliveryOptionDTOFromJson(json);

  Map<dynamic, dynamic> toJson() => _$DeliveryOptionDTOToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
class DeliveryDTO {
  DeliveryDTO({
    required this.internalReceiptNo,
    required this.specialAggreements,
    required this.currency,
    required this.notes,
    required this.totalPrice,
    required this.prepayment,
    required this.paymentAtDelivery,
    required this.desiredTime,
    required this.contactPerson,
    required this.articles,
    required this.totalNetValue,
    required this.totalGrossValue,
    required this.images,
    required this.customer,
    required this.finishedTime,
    required this.note,
    required this.state,
    required this.payment,
    required this.carId,
    required this.options,
  });

  String internalReceiptNo;
  String? specialAggreements;
  CustomerDTO customer;
  String totalPrice;
  String desiredTime;
  String totalGrossValue;
  String totalNetValue;
  ContactPersonDTO contactPerson;
  String? currency;
  List<ArticleDTO> articles;
  String note;
  String finishedTime;
  String carId;
  String state;
  String prepayment;
  String paymentAtDelivery;
  DiscountDTO? discount;
  PaymentMethodDTO payment;
  List<NoteDTO> notes;
  List<ImageNoteDTO> images;
  List<DeliveryOptionDTO> options;

  factory DeliveryDTO.fromJson(Map<String, dynamic> json) =>
      _$DeliveryDTOFromJson(json);

  Map<dynamic, dynamic> toJson() => _$DeliveryDTOToJson(this);
}
