import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';

class OrderDetailModel {
  String id;
  int storeId;
  String orderGuid;
  bool pickUpInStore;
  String paymentMethodSystemName;
  String paymentName;
  String paymentNamen;
  String customerCurrencyCode;
  dynamic currencyRate;
  dynamic customerTaxDisplayTypeId;
  dynamic vatNumber;
  double orderSubtotalInclTax;
  double orderSubtotalExclTax;
  dynamic orderSubTotalDiscountInclTax;
  dynamic orderSubTotalDiscountExclTax;
  double orderShippingInclTax;
  dynamic orderShippingExclTax;
  dynamic paymentMethodAdditionalFeeInclTax;
  dynamic paymentMethodAdditionalFeeExclTax;
  String taxRates;
  double orderTax;
  dynamic orderDiscount;
  dynamic productCount;
  dynamic orderTotal;
  dynamic refundedAmount;
  dynamic rewardPointsWereAdded;
  dynamic rxAttachments;
  String checkoutAttributeDescription;
  int customerLanguageId;
  int affiliateId;
  String customerIp;
  dynamic authorizationTransactionId;
  dynamic authorizationTransactionCode;
  dynamic authorizationTransactionResult;
  dynamic captureTransactionId;
  dynamic captureTransactionResult;
  dynamic subscriptionTransactionId;
  dynamic paidDateUtc;
  String shippingMethod;
  String shippingRateComputationMethodSystemName;
  String customValuesXml;
  bool deleted;
  String createdOnUtc;
  Customer customer;
  int customerId;
  BillingAddress billingAddress;
  BillingAddress shippingAddress;
  List<ShoppingCart> orderItems;
  int orderStatusId;
  String orderStatus;
  String orderStatusn;
  int paymentStatusId;
  String paymentStatus;
  String paymentStatusn;
  String shippingStatus;
  String shippingStatusn;
  String customerTaxDisplayType;
  bool canCancel;
  bool canRefund;
  dynamic lakumAmount;
  String preferDeliveryDate;
  String preferDeliveryTime;
  String preferDeliveryTimen;
  String driverOTP;
  String driverID;

  OrderDetailModel(
      {this.id,
        this.storeId,
        this.orderGuid,
        this.pickUpInStore,
        this.paymentMethodSystemName,
        this.paymentName,
        this.paymentNamen,
        this.customerCurrencyCode,
        this.currencyRate,
        this.customerTaxDisplayTypeId,
        this.vatNumber,
        this.orderSubtotalInclTax,
        this.orderSubtotalExclTax,
        this.orderSubTotalDiscountInclTax,
        this.orderSubTotalDiscountExclTax,
        this.orderShippingInclTax,
        this.orderShippingExclTax,
        this.paymentMethodAdditionalFeeInclTax,
        this.paymentMethodAdditionalFeeExclTax,
        this.taxRates,
        this.orderTax,
        this.orderDiscount,
        this.productCount,
        this.orderTotal,
        this.refundedAmount,
        this.rewardPointsWereAdded,
        this.rxAttachments,
        this.checkoutAttributeDescription,
        this.customerLanguageId,
        this.affiliateId,
        this.customerIp,
        this.authorizationTransactionId,
        this.authorizationTransactionCode,
        this.authorizationTransactionResult,
        this.captureTransactionId,
        this.captureTransactionResult,
        this.subscriptionTransactionId,
        this.paidDateUtc,
        this.shippingMethod,
        this.shippingRateComputationMethodSystemName,
        this.customValuesXml,
        this.deleted,
        this.createdOnUtc,
        this.customer,
        this.customerId,
        this.billingAddress,
        this.shippingAddress,
        this.orderItems,
        this.orderStatusId,
        this.orderStatus,
        this.orderStatusn,
        this.paymentStatusId,
        this.paymentStatus,
        this.paymentStatusn,
        this.shippingStatus,
        this.shippingStatusn,
        this.customerTaxDisplayType,
        this.canCancel,
        this.canRefund,
        this.lakumAmount,
        this.preferDeliveryDate,
        this.preferDeliveryTime,
        this.preferDeliveryTimen,
        this.driverID,
        this.driverOTP,});

  OrderDetailModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    storeId = json['store_id'];
    orderGuid = json['order_guid'];
    pickUpInStore = json['pick_up_in_store'];
    paymentMethodSystemName = json['payment_method_system_name'];
    paymentName = json['payment_name'];
    paymentNamen = json['payment_namen'];
    customerCurrencyCode = json['customer_currency_code'];
    currencyRate = json['currency_rate'];
    customerTaxDisplayTypeId = json['customer_tax_display_type_id'];
    vatNumber = json['vat_number'];
    orderSubtotalInclTax = json['order_subtotal_incl_tax'];
    orderSubtotalExclTax = json['order_subtotal_excl_tax'];
    orderSubTotalDiscountInclTax = json['order_sub_total_discount_incl_tax'];
    orderSubTotalDiscountExclTax = json['order_sub_total_discount_excl_tax'];
    orderShippingInclTax = json['order_shipping_incl_tax'];
    orderShippingExclTax = json['order_shipping_excl_tax'];
    paymentMethodAdditionalFeeInclTax =
    json['payment_method_additional_fee_incl_tax'];
    paymentMethodAdditionalFeeExclTax =
    json['payment_method_additional_fee_excl_tax'];
    taxRates = json['tax_rates'];
    orderTax = json['order_tax'];
    orderDiscount = json['order_discount'];
    productCount = json['product_count'];
    orderTotal = json['order_total'];
    refundedAmount = json['refunded_amount'];
    rewardPointsWereAdded = json['reward_points_were_added'];
    rxAttachments = json['rx_attachments'];
    checkoutAttributeDescription = json['checkout_attribute_description'];
    customerLanguageId = json['customer_language_id'];
    affiliateId = json['affiliate_id'];
    customerIp = json['customer_ip'];
    authorizationTransactionId = json['authorization_transaction_id'];
    authorizationTransactionCode = json['authorization_transaction_code'];
    authorizationTransactionResult = json['authorization_transaction_result'];
    captureTransactionId = json['capture_transaction_id'];
    captureTransactionResult = json['capture_transaction_result'];
    subscriptionTransactionId = json['subscription_transaction_id'];
    paidDateUtc = json['paid_date_utc'];
    shippingMethod = json['shipping_method'];
    shippingRateComputationMethodSystemName =
    json['shipping_rate_computation_method_system_name'];
    customValuesXml = json['custom_values_xml'];
    deleted = json['deleted'];
    createdOnUtc = json['created_on_utc'];
    customer = json['customer'] != null
        ? new Customer.fromJson(json['customer'])
        : null;
    customerId = json['customer_id'];
    billingAddress = json['billing_address'] != null
        ? new BillingAddress.fromJson(json['billing_address'])
        : null;
    shippingAddress = json['shipping_address'] != null
        ? new BillingAddress.fromJson(json['shipping_address'])
        : null;
    if (json['order_items'] != null) {
      orderItems = new List<ShoppingCart>();
      json['order_items'].forEach((v) {
        orderItems.add(new ShoppingCart.fromJson(v));
      });
    }
    orderStatusId = json['order_status_id'];
    orderStatus = json['order_status'];
    orderStatusn = json['order_statusn'];
    paymentStatusId = json['payment_status_id'];
    paymentStatus = json['payment_status'];
    paymentStatusn = json['payment_statusn'];
    shippingStatus = json['shipping_status'];
    shippingStatusn = json['shipping_statusn'];
    customerTaxDisplayType = json['customer_tax_display_type'];
    canCancel = json['can_cancel'];
    canRefund = json['can_refund'];
    lakumAmount = json['lakum_amount'];
    preferDeliveryDate = json['prefer_delivery_date'];
    preferDeliveryTime = json['prefer_delivery_time'];
    preferDeliveryTimen = json['prefer_delivery_timen'];

    // Driver Detail
    driverID: json["DriverID"];
    driverOTP: json["DriverOTP"];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['store_id'] = this.storeId;
    data['order_guid'] = this.orderGuid;
    data['pick_up_in_store'] = this.pickUpInStore;
    data['payment_method_system_name'] = this.paymentMethodSystemName;
    data['payment_name'] = this.paymentName;
    data['payment_namen'] = this.paymentNamen;
    data['customer_currency_code'] = this.customerCurrencyCode;
    data['currency_rate'] = this.currencyRate;
    data['customer_tax_display_type_id'] = this.customerTaxDisplayTypeId;
    data['vat_number'] = this.vatNumber;
    data['order_subtotal_incl_tax'] = this.orderSubtotalInclTax;
    data['order_subtotal_excl_tax'] = this.orderSubtotalExclTax;
    data['order_sub_total_discount_incl_tax'] =
        this.orderSubTotalDiscountInclTax;
    data['order_sub_total_discount_excl_tax'] =
        this.orderSubTotalDiscountExclTax;
    data['order_shipping_incl_tax'] = this.orderShippingInclTax;
    data['order_shipping_excl_tax'] = this.orderShippingExclTax;
    data['payment_method_additional_fee_incl_tax'] =
        this.paymentMethodAdditionalFeeInclTax;
    data['payment_method_additional_fee_excl_tax'] =
        this.paymentMethodAdditionalFeeExclTax;
    data['tax_rates'] = this.taxRates;
    data['order_tax'] = this.orderTax;
    data['order_discount'] = this.orderDiscount;
    data['product_count'] = this.productCount;
    data['order_total'] = this.orderTotal;
    data['refunded_amount'] = this.refundedAmount;
    data['reward_points_were_added'] = this.rewardPointsWereAdded;
    data['rx_attachments'] = this.rxAttachments;
    data['checkout_attribute_description'] = this.checkoutAttributeDescription;
    data['customer_language_id'] = this.customerLanguageId;
    data['affiliate_id'] = this.affiliateId;
    data['customer_ip'] = this.customerIp;
    data['authorization_transaction_id'] = this.authorizationTransactionId;
    data['authorization_transaction_code'] = this.authorizationTransactionCode;
    data['authorization_transaction_result'] =
        this.authorizationTransactionResult;
    data['capture_transaction_id'] = this.captureTransactionId;
    data['capture_transaction_result'] = this.captureTransactionResult;
    data['subscription_transaction_id'] = this.subscriptionTransactionId;
    data['paid_date_utc'] = this.paidDateUtc;
    data['shipping_method'] = this.shippingMethod;
    data['shipping_rate_computation_method_system_name'] =
        this.shippingRateComputationMethodSystemName;
    data['custom_values_xml'] = this.customValuesXml;
    data['deleted'] = this.deleted;
    data['created_on_utc'] = this.createdOnUtc;
    if (this.customer != null) {
      data['customer'] = this.customer.toJson();
    }
    data['customer_id'] = this.customerId;
    if (this.billingAddress != null) {
      data['billing_address'] = this.billingAddress.toJson();
    }
    if (this.shippingAddress != null) {
      data['shipping_address'] = this.shippingAddress.toJson();
    }
    if (this.orderItems != null) {
      data['order_items'] = this.orderItems.map((v) => v.toJson()).toList();
    }
    data['order_status_id'] = this.orderStatusId;
    data['order_status'] = this.orderStatus;
    data['order_statusn'] = this.orderStatusn;
    data['payment_status_id'] = this.paymentStatusId;
    data['payment_status'] = this.paymentStatus;
    data['payment_statusn'] = this.paymentStatusn;
    data['shipping_status'] = this.shippingStatus;
    data['shipping_statusn'] = this.shippingStatusn;
    data['customer_tax_display_type'] = this.customerTaxDisplayType;
    data['can_cancel'] = this.canCancel;
    data['can_refund'] = this.canRefund;
    data['lakum_amount'] = this.lakumAmount;
    data['prefer_delivery_date'] = this.preferDeliveryDate;
    data['prefer_delivery_time'] = this.preferDeliveryTime;
    data['prefer_delivery_timen'] = this.preferDeliveryTimen;
    return data;
  }

}