import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';

offerProductsResponseModelFromJson(PackagesResponseModel data, Map<String, dynamic> json) {
  if (json['id'] != null) {
    data.id = json['id'];
  }
  if (json['visible_individually'] != null) {
    data.visibleIndividually = json['visible_individually'];
  }
  if (json['name'] != null) {
    data.name = json['name']?.toString();
  }
  if (json['namen'] != null) {
    data.namen = json['namen']?.toString();
  }
  if (json['localized_names'] != null) {
    data.localizedNames = new List<OfferProductsResponseModelLocalizedName>();
    (json['localized_names'] as List).forEach((v) {
      data.localizedNames.add(new OfferProductsResponseModelLocalizedName().fromJson(v));
    });
  }
  if (json['short_description'] != null) {
    data.shortDescription = json['short_description']?.toString();
  }
  if (json['short_descriptionn'] != null) {
    data.shortDescriptionn = json['short_descriptionn']?.toString();
  }
  if (json['full_description'] != null) {
    data.fullDescription = json['full_description']?.toString();
  }
  if (json['full_descriptionn'] != null) {
    data.fullDescriptionn = json['full_descriptionn']?.toString();
  }
  if (json['markas_new'] != null) {
    data.markasNew = json['markas_new'];
  }
  if (json['show_on_home_page'] != null) {
    data.showOnHomePage = json['show_on_home_page'];
  }
  if (json['meta_keywords'] != null) {
    data.metaKeywords = json['meta_keywords'];
  }
  if (json['meta_description'] != null) {
    data.metaDescription = json['meta_description'];
  }
  if (json['meta_title'] != null) {
    data.metaTitle = json['meta_title'];
  }
  if (json['allow_customer_reviews'] != null) {
    data.allowCustomerReviews = json['allow_customer_reviews'];
  }
  if (json['approved_rating_sum'] != null) {
    data.approvedRatingSum = json['approved_rating_sum']?.toInt();
  }
  if (json['not_approved_rating_sum'] != null) {
    data.notApprovedRatingSum = json['not_approved_rating_sum']?.toInt();
  }
  if (json['approved_total_reviews'] != null) {
    data.approvedTotalReviews = json['approved_total_reviews']?.toInt();
  }
  if (json['not_approved_total_reviews'] != null) {
    data.notApprovedTotalReviews = json['not_approved_total_reviews']?.toInt();
  }
  if (json['sku'] != null) {
    data.sku = json['sku']?.toString();
  }
  if (json['is_rx'] != null) {
    data.isRx = json['is_rx'];
  }
  if (json['prescription_required'] != null) {
    data.prescriptionRequired = json['prescription_required'];
  }
  if (json['rx_message'] != null) {
    data.rxMessage = json['rx_message'];
  }
  if (json['rx_messagen'] != null) {
    data.rxMessagen = json['rx_messagen'];
  }
  if (json['manufacturer_part_number'] != null) {
    data.manufacturerPartNumber = json['manufacturer_part_number'];
  }
  if (json['gtin'] != null) {
    data.gtin = json['gtin'];
  }
  if (json['is_gift_card'] != null) {
    data.isGiftCard = json['is_gift_card'];
  }
  if (json['require_other_products'] != null) {
    data.requireOtherProducts = json['require_other_products'];
  }
  if (json['automatically_add_required_products'] != null) {
    data.automaticallyAddRequiredProducts = json['automatically_add_required_products'];
  }
  if (json['is_download'] != null) {
    data.isDownload = json['is_download'];
  }
  if (json['unlimited_downloads'] != null) {
    data.unlimitedDownloads = json['unlimited_downloads'];
  }
  if (json['max_number_of_downloads'] != null) {
    data.maxNumberOfDownloads = json['max_number_of_downloads']?.toInt();
  }
  if (json['download_expiration_days'] != null) {
    data.downloadExpirationDays = json['download_expiration_days'];
  }
  if (json['has_sample_download'] != null) {
    data.hasSampleDownload = json['has_sample_download'];
  }
  if (json['has_user_agreement'] != null) {
    data.hasUserAgreement = json['has_user_agreement'];
  }
  if (json['is_recurring'] != null) {
    data.isRecurring = json['is_recurring'];
  }
  if (json['recurring_cycle_length'] != null) {
    data.recurringCycleLength = json['recurring_cycle_length']?.toInt();
  }
  if (json['recurring_total_cycles'] != null) {
    data.recurringTotalCycles = json['recurring_total_cycles']?.toInt();
  }
  if (json['is_rental'] != null) {
    data.isRental = json['is_rental'];
  }
  if (json['rental_price_length'] != null) {
    data.rentalPriceLength = json['rental_price_length']?.toInt();
  }
  if (json['is_ship_enabled'] != null) {
    data.isShipEnabled = json['is_ship_enabled'];
  }
  if (json['is_free_shipping'] != null) {
    data.isFreeShipping = json['is_free_shipping'];
  }
  if (json['ship_separately'] != null) {
    data.shipSeparately = json['ship_separately'];
  }
  if (json['additional_shipping_charge'] != null) {
    data.additionalShippingCharge = json['additional_shipping_charge']?.toDouble();
  }
  if (json['is_tax_exempt'] != null) {
    data.isTaxExempt = json['is_tax_exempt'];
  }
  if (json['is_telecommunications_or_broadcasting_or_electronic_services'] != null) {
    data.isTelecommunicationsOrBroadcastingOrElectronicServices = json['is_telecommunications_or_broadcasting_or_electronic_services'];
  }
  if (json['use_multiple_warehouses'] != null) {
    data.useMultipleWarehouses = json['use_multiple_warehouses'];
  }
  if (json['manage_inventory_method_id'] != null) {
    data.manageInventoryMethodId = json['manage_inventory_method_id']?.toInt();
  }
  if (json['stock_quantity'] != null) {
    data.stockQuantity = json['stock_quantity']?.toInt();
  }
  if (json['stock_availability'] != null) {
    data.stockAvailability = json['stock_availability']?.toString();
  }
  if (json['stock_availabilityn'] != null) {
    data.stockAvailabilityn = json['stock_availabilityn']?.toString();
  }
  if (json['display_stock_availability'] != null) {
    data.displayStockAvailability = json['display_stock_availability'];
  }
  if (json['display_stock_quantity'] != null) {
    data.displayStockQuantity = json['display_stock_quantity'];
  }
  if (json['min_stock_quantity'] != null) {
    data.minStockQuantity = json['min_stock_quantity']?.toInt();
  }
  if (json['notify_admin_for_quantity_below'] != null) {
    data.notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']?.toInt();
  }
  if (json['allow_back_in_stock_subscriptions'] != null) {
    data.allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
  }
  if (json['order_minimum_quantity'] != null) {
    data.orderMinimumQuantity = json['order_minimum_quantity']?.toInt();
  }
  if (json['order_maximum_quantity'] != null) {
    data.orderMaximumQuantity = json['order_maximum_quantity']?.toInt();
  }
  if (json['allowed_quantities'] != null) {
    data.allowedQuantities = json['allowed_quantities'];
  }
  if (json['allow_adding_only_existing_attribute_combinations'] != null) {
    data.allowAddingOnlyExistingAttributeCombinations = json['allow_adding_only_existing_attribute_combinations'];
  }
  if (json['disable_buy_button'] != null) {
    data.disableBuyButton = json['disable_buy_button'];
  }
  if (json['disable_wishlist_button'] != null) {
    data.disableWishlistButton = json['disable_wishlist_button'];
  }
  if (json['available_for_pre_order'] != null) {
    data.availableForPreOrder = json['available_for_pre_order'];
  }
  if (json['pre_order_availability_start_date_time_utc'] != null) {
    data.preOrderAvailabilityStartDateTimeUtc = json['pre_order_availability_start_date_time_utc'];
  }
  if (json['call_for_price'] != null) {
    data.callForPrice = json['call_for_price'];
  }
  if (json['price'] != null) {
    data.price = json['price']?.toDouble();
  }
  if (json['old_price'] != null) {
    data.oldPrice = json['old_price']?.toDouble();
  }
  if (json['product_cost'] != null) {
    data.productCost = json['product_cost']?.toDouble();
  }
  if (json['special_price'] != null) {
    data.specialPrice = json['special_price'];
  }
  if (json['special_price_start_date_time_utc'] != null) {
    data.specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc'];
  }
  if (json['special_price_end_date_time_utc'] != null) {
    data.specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc'];
  }
  if (json['customer_enters_price'] != null) {
    data.customerEntersPrice = json['customer_enters_price'];
  }
  if (json['minimum_customer_entered_price'] != null) {
    data.minimumCustomerEnteredPrice = json['minimum_customer_entered_price']?.toDouble();
  }
  if (json['maximum_customer_entered_price'] != null) {
    data.maximumCustomerEnteredPrice = json['maximum_customer_entered_price']?.toDouble();
  }
  if (json['baseprice_enabled'] != null) {
    data.basepriceEnabled = json['baseprice_enabled'];
  }
  if (json['baseprice_amount'] != null) {
    data.basepriceAmount = json['baseprice_amount']?.toDouble();
  }
  if (json['baseprice_base_amount'] != null) {
    data.basepriceBaseAmount = json['baseprice_base_amount']?.toDouble();
  }
  if (json['has_tier_prices'] != null) {
    data.hasTierPrices = json['has_tier_prices'];
  }
  if (json['has_discounts_applied'] != null) {
    data.hasDiscountsApplied = json['has_discounts_applied'];
  }
  if (json['discount_name'] != null) {
    data.discountName = json['discount_name'];
  }
  if (json['discount_namen'] != null) {
    data.discountNamen = json['discount_namen'];
  }
  if (json['discount_description'] != null) {
    data.discountDescription = json['discount_description'];
  }
  if (json['discount_Descriptionn'] != null) {
    data.discountDescriptionn = json['discount_Descriptionn'];
  }
  if (json['discount_percentage'] != null) {
    data.discountPercentage = json['discount_percentage'];
  }
  if (json['currency'] != null) {
    data.currency = json['currency']?.toString();
  }
  if (json['currencyn'] != null) {
    data.currencyn = json['currencyn']?.toString();
  }
  if (json['weight'] != null) {
    data.weight = json['weight']?.toDouble();
  }
  if (json['length'] != null) {
    data.length = json['length']?.toDouble();
  }
  if (json['width'] != null) {
    data.width = json['width']?.toDouble();
  }
  if (json['height'] != null) {
    data.height = json['height']?.toDouble();
  }
  if (json['available_start_date_time_utc'] != null) {
    data.availableStartDateTimeUtc = json['available_start_date_time_utc'];
  }
  if (json['available_end_date_time_utc'] != null) {
    data.availableEndDateTimeUtc = json['available_end_date_time_utc'];
  }
  if (json['display_order'] != null) {
    data.displayOrder = json['display_order']?.toInt();
  }
  if (json['published'] != null) {
    data.published = json['published'];
  }
  if (json['deleted'] != null) {
    data.deleted = json['deleted'];
  }
  if (json['created_on_utc'] != null) {
    data.createdOnUtc = json['created_on_utc']?.toString();
  }
  if (json['updated_on_utc'] != null) {
    data.updatedOnUtc = json['updated_on_utc']?.toString();
  }
  if (json['product_type'] != null) {
    data.productType = json['product_type']?.toString();
  }
  if (json['parent_grouped_product_id'] != null) {
    data.parentGroupedProductId = json['parent_grouped_product_id']?.toInt();
  }
  if (json['role_ids'] != null) {
    data.roleIds = new List<dynamic>();
    data.roleIds.addAll(json['role_ids']);
  }
  if (json['discount_ids'] != null) {
    data.discountIds = new List<dynamic>();
    data.discountIds.addAll(json['discount_ids']);
  }
  if (json['store_ids'] != null) {
    data.storeIds = new List<dynamic>();
    data.storeIds.addAll(json['store_ids']);
  }

  if (json['store_names'] != null) {
    data.storeNames = new List<dynamic>();
    data.storeNames.addAll(json['store_names']);
  }

  if (json['manufacturer_ids'] != null) {
    data.manufacturerIds = json['manufacturer_ids']?.map((v) => v?.toInt())?.toList()?.cast<int>();
  }
  if (json['reviews'] != null) {
    data.reviews = new List<dynamic>();
    data.reviews.addAll(json['reviews']);
  }
  if (json['images'] != null) {
    data.images = new List<OfferProductsResponseModelImage>();
    (json['images'] as List).forEach((v) {
      data.images.add(new OfferProductsResponseModelImage().fromJson(v));
    });
  }
  if (json['attributes'] != null) {
    data.attributes = new List<dynamic>();
    data.attributes.addAll(json['attributes']);
  }
  if (json['specifications'] != null) {
    data.specifications = new List<OfferProductsResponseModelSpecification>();
    (json['specifications'] as List).forEach((v) {
      data.specifications.add(new OfferProductsResponseModelSpecification().fromJson(v));
    });
  }
  if (json['associated_product_ids'] != null) {
    data.associatedProductIds = new List<dynamic>();
    data.associatedProductIds.addAll(json['associated_product_ids']);
  }
  if (json['tags'] != null) {
    data.tags = new List<dynamic>();
    data.tags.addAll(json['tags']);
  }
  if (json['vendor_id'] != null) {
    data.vendorId = json['vendor_id']?.toInt();
  }
  if (json['se_name'] != null) {
    data.seName = json['se_name']?.toString();
  }
  return data;
}

Map<String, dynamic> offerProductsResponseModelToJson(PackagesResponseModel entity) {
  final Map<String, dynamic> data = new Map<String, dynamic>();
  data['id'] = entity.id;
  data['visible_individually'] = entity.visibleIndividually;
  data['name'] = entity.name;
  data['namen'] = entity.namen;
  if (entity.localizedNames != null) {
    data['localized_names'] = entity.localizedNames.map((v) => v.toJson()).toList();
  }
  data['short_description'] = entity.shortDescription;
  data['short_descriptionn'] = entity.shortDescriptionn;
  data['full_description'] = entity.fullDescription;
  data['full_descriptionn'] = entity.fullDescriptionn;
  data['markas_new'] = entity.markasNew;
  data['show_on_home_page'] = entity.showOnHomePage;
  data['meta_keywords'] = entity.metaKeywords;
  data['meta_description'] = entity.metaDescription;
  data['meta_title'] = entity.metaTitle;
  data['allow_customer_reviews'] = entity.allowCustomerReviews;
  data['approved_rating_sum'] = entity.approvedRatingSum;
  data['not_approved_rating_sum'] = entity.notApprovedRatingSum;
  data['approved_total_reviews'] = entity.approvedTotalReviews;
  data['not_approved_total_reviews'] = entity.notApprovedTotalReviews;
  data['sku'] = entity.sku;
  data['is_rx'] = entity.isRx;
  data['prescription_required'] = entity.prescriptionRequired;
  data['rx_message'] = entity.rxMessage;
  data['rx_messagen'] = entity.rxMessagen;
  data['manufacturer_part_number'] = entity.manufacturerPartNumber;
  data['gtin'] = entity.gtin;
  data['is_gift_card'] = entity.isGiftCard;
  data['require_other_products'] = entity.requireOtherProducts;
  data['automatically_add_required_products'] = entity.automaticallyAddRequiredProducts;
  data['is_download'] = entity.isDownload;
  data['unlimited_downloads'] = entity.unlimitedDownloads;
  data['max_number_of_downloads'] = entity.maxNumberOfDownloads;
  data['download_expiration_days'] = entity.downloadExpirationDays;
  data['has_sample_download'] = entity.hasSampleDownload;
  data['has_user_agreement'] = entity.hasUserAgreement;
  data['is_recurring'] = entity.isRecurring;
  data['recurring_cycle_length'] = entity.recurringCycleLength;
  data['recurring_total_cycles'] = entity.recurringTotalCycles;
  data['is_rental'] = entity.isRental;
  data['rental_price_length'] = entity.rentalPriceLength;
  data['is_ship_enabled'] = entity.isShipEnabled;
  data['is_free_shipping'] = entity.isFreeShipping;
  data['ship_separately'] = entity.shipSeparately;
  data['additional_shipping_charge'] = entity.additionalShippingCharge;
  data['is_tax_exempt'] = entity.isTaxExempt;
  data['is_telecommunications_or_broadcasting_or_electronic_services'] = entity.isTelecommunicationsOrBroadcastingOrElectronicServices;
  data['use_multiple_warehouses'] = entity.useMultipleWarehouses;
  data['manage_inventory_method_id'] = entity.manageInventoryMethodId;
  data['stock_quantity'] = entity.stockQuantity;
  data['stock_availability'] = entity.stockAvailability;
  data['stock_availabilityn'] = entity.stockAvailabilityn;
  data['display_stock_availability'] = entity.displayStockAvailability;
  data['display_stock_quantity'] = entity.displayStockQuantity;
  data['min_stock_quantity'] = entity.minStockQuantity;
  data['notify_admin_for_quantity_below'] = entity.notifyAdminForQuantityBelow;
  data['allow_back_in_stock_subscriptions'] = entity.allowBackInStockSubscriptions;
  data['order_minimum_quantity'] = entity.orderMinimumQuantity;
  data['order_maximum_quantity'] = entity.orderMaximumQuantity;
  data['allowed_quantities'] = entity.allowedQuantities;
  data['allow_adding_only_existing_attribute_combinations'] = entity.allowAddingOnlyExistingAttributeCombinations;
  data['disable_buy_button'] = entity.disableBuyButton;
  data['disable_wishlist_button'] = entity.disableWishlistButton;
  data['available_for_pre_order'] = entity.availableForPreOrder;
  data['pre_order_availability_start_date_time_utc'] = entity.preOrderAvailabilityStartDateTimeUtc;
  data['call_for_price'] = entity.callForPrice;
  data['price'] = entity.price;
  data['old_price'] = entity.oldPrice;
  data['product_cost'] = entity.productCost;
  data['special_price'] = entity.specialPrice;
  data['special_price_start_date_time_utc'] = entity.specialPriceStartDateTimeUtc;
  data['special_price_end_date_time_utc'] = entity.specialPriceEndDateTimeUtc;
  data['customer_enters_price'] = entity.customerEntersPrice;
  data['minimum_customer_entered_price'] = entity.minimumCustomerEnteredPrice;
  data['maximum_customer_entered_price'] = entity.maximumCustomerEnteredPrice;
  data['baseprice_enabled'] = entity.basepriceEnabled;
  data['baseprice_amount'] = entity.basepriceAmount;
  data['baseprice_base_amount'] = entity.basepriceBaseAmount;
  data['has_tier_prices'] = entity.hasTierPrices;
  data['has_discounts_applied'] = entity.hasDiscountsApplied;
  data['discount_name'] = entity.discountName;
  data['discount_namen'] = entity.discountNamen;
  data['discount_description'] = entity.discountDescription;
  data['discount_Descriptionn'] = entity.discountDescriptionn;
  data['discount_percentage'] = entity.discountPercentage;
  data['currency'] = entity.currency;
  data['currencyn'] = entity.currencyn;
  data['weight'] = entity.weight;
  data['length'] = entity.length;
  data['width'] = entity.width;
  data['height'] = entity.height;
  data['available_start_date_time_utc'] = entity.availableStartDateTimeUtc;
  data['available_end_date_time_utc'] = entity.availableEndDateTimeUtc;
  data['display_order'] = entity.displayOrder;
  data['published'] = entity.published;
  data['deleted'] = entity.deleted;
  data['created_on_utc'] = entity.createdOnUtc;
  data['updated_on_utc'] = entity.updatedOnUtc;
  data['product_type'] = entity.productType;
  data['parent_grouped_product_id'] = entity.parentGroupedProductId;
  if (entity.roleIds != null) {
    data['role_ids'] = [];
  }
  if (entity.discountIds != null) {
    data['discount_ids'] = [];
  }
  if (entity.storeIds != null) {
    data['store_ids'] = [];
  }
  data['manufacturer_ids'] = entity.manufacturerIds;
  if (entity.reviews != null) {
    data['reviews'] = [];
  }
  if (entity.images != null) {
    data['images'] = entity.images.map((v) => v.toJson()).toList();
  }
  if (entity.attributes != null) {
    data['attributes'] = [];
  }
  if (entity.specifications != null) {
    data['specifications'] = entity.specifications.map((v) => v.toJson()).toList();
  }
  if (entity.associatedProductIds != null) {
    data['associated_product_ids'] = [];
  }
  if (entity.tags != null) {
    data['tags'] = [];
  }
  data['vendor_id'] = entity.vendorId;
  data['se_name'] = entity.seName;
  return data;
}

offerProductsResponseModelLocalizedNameFromJson(OfferProductsResponseModelLocalizedName data, Map<String, dynamic> json) {
  if (json['language_id'] != null) {
    data.languageId = json['language_id']?.toInt();
  }
  if (json['localized_name'] != null) {
    data.localizedName = json['localized_name']?.toString();
  }
  return data;
}

Map<String, dynamic> offerProductsResponseModelLocalizedNameToJson(OfferProductsResponseModelLocalizedName entity) {
  final Map<String, dynamic> data = new Map<String, dynamic>();
  data['language_id'] = entity.languageId;
  data['localized_name'] = entity.localizedName;
  return data;
}

offerProductsResponseModelImageFromJson(OfferProductsResponseModelImage data, Map<String, dynamic> json) {
  if (json['id'] != null) {
    data.id = json['id']?.toInt();
  }
  if (json['position'] != null) {
    data.position = json['position']?.toInt();
  }
  if (json['src'] != null) {
    data.src = json['src']?.toString();
  }
  if (json['thumb'] != null) {
    data.thumb = json['thumb']?.toString();
  }
  if (json['attachment'] != null) {
    data.attachment = json['attachment']?.toString();
  }
  return data;
}

Map<String, dynamic> offerProductsResponseModelImageToJson(OfferProductsResponseModelImage entity) {
  final Map<String, dynamic> data = new Map<String, dynamic>();
  data['id'] = entity.id;
  data['position'] = entity.position;
  data['src'] = entity.src;
  data['thumb'] = entity.thumb;
  data['attachment'] = entity.attachment;
  return data;
}

offerProductsResponseModelSpecificationFromJson(OfferProductsResponseModelSpecification data, Map<String, dynamic> json) {
  if (json['id'] != null) {
    data.id = json['id']?.toInt();
  }
  if (json['display_order'] != null) {
    data.displayOrder = json['display_order']?.toInt();
  }
  if (json['default_value'] != null) {
    data.defaultValue = json['default_value']?.toString();
  }
  if (json['default_valuen'] != null) {
    data.defaultValuen = json['default_valuen']?.toString();
  }
  if (json['name'] != null) {
    data.name = json['name']?.toString();
  }
  if (json['nameN'] != null) {
    data.nameN = json['nameN']?.toString();
  }
  return data;
}

Map<String, dynamic> offerProductsResponseModelSpecificationToJson(OfferProductsResponseModelSpecification entity) {
  final Map<String, dynamic> data = new Map<String, dynamic>();
  data['id'] = entity.id;
  data['display_order'] = entity.displayOrder;
  data['default_value'] = entity.defaultValue;
  data['default_valuen'] = entity.defaultValuen;
  data['name'] = entity.name;
  data['nameN'] = entity.nameN;
  return data;
}
