class SearchProductsModel {
  String id;
  String name;
  String namen;
  List<LocalizedNames> localizedNames;
  String shortDescription;
  String fullDescription;
  String fullDescriptionn;
  dynamic approvedRatingSum;
  dynamic approvedTotalReviews;
  String sku;
  bool isRx;
  dynamic rxMessage;
  dynamic rxMessagen;
  dynamic stockQuantity;
  String stockAvailability;
  String stockAvailabilityn;
  bool allowBackInStockSubscriptions;
  dynamic orderMinimumQuantity;
  dynamic orderMaximumQuantity;
  double price;
  dynamic oldPrice;
  dynamic discountName;
  dynamic discountNamen;
  dynamic discountPercentage;
  dynamic displayOrder;
  List<dynamic> discountIds;
  List<dynamic> reviews;
  List<Images> images;

  SearchProductsModel(
      {this.id,
      this.name,
      this.namen,
      this.localizedNames,
      this.shortDescription,
      this.fullDescription,
      this.fullDescriptionn,
      this.approvedRatingSum,
      this.approvedTotalReviews,
      this.sku,
      this.isRx,
      this.rxMessage,
      this.rxMessagen,
      this.stockQuantity,
      this.stockAvailability,
      this.stockAvailabilityn,
      this.allowBackInStockSubscriptions,
      this.orderMinimumQuantity,
      this.orderMaximumQuantity,
      this.price,
      this.oldPrice,
      this.discountName,
      this.discountNamen,
      this.discountPercentage,
      this.displayOrder,
      this.discountIds,
      this.reviews,
      this.images});

  SearchProductsModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    namen = json['namen'];
    if (json['localized_names'] != null) {
      localizedNames = new List<LocalizedNames>();
      json['localized_names'].forEach((v) {
        localizedNames.add(new LocalizedNames.fromJson(v));
      });
    }
    shortDescription = json['short_description'];
    fullDescription = json['full_description'];
    fullDescriptionn = json['full_descriptionn'];
    approvedRatingSum = json['approved_rating_sum'];
    approvedTotalReviews = json['approved_total_reviews'];
    sku = json['sku'];
    isRx = json['is_rx'];
    rxMessage = json['rx_message'];
    rxMessagen = json['rx_messagen'];
    stockQuantity = json['stock_quantity'];
    stockAvailability = json['stock_availability'];
    stockAvailabilityn = json['stock_availabilityn'];
    allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
    orderMinimumQuantity = json['order_minimum_quantity'];
    orderMaximumQuantity = json['order_maximum_quantity'];
    price = json['price'];
    oldPrice = json['old_price'];
    discountName = json['discount_name'];
    discountNamen = json['discount_namen'];
    discountPercentage = json['discount_percentage'];
    displayOrder = json['display_order'];

    if (json['images'] != null) {
      images = new List<Images>();
      json['images'].forEach((v) {
        images.add(new Images.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['namen'] = this.namen;
    if (this.localizedNames != null) {
      data['localized_names'] =
          this.localizedNames.map((v) => v.toJson()).toList();
    }
    data['short_description'] = this.shortDescription;
    data['full_description'] = this.fullDescription;
    data['full_descriptionn'] = this.fullDescriptionn;
    data['approved_rating_sum'] = this.approvedRatingSum;
    data['approved_total_reviews'] = this.approvedTotalReviews;
    data['sku'] = this.sku;
    data['is_rx'] = this.isRx;
    data['rx_message'] = this.rxMessage;
    data['rx_messagen'] = this.rxMessagen;
    data['stock_quantity'] = this.stockQuantity;
    data['stock_availability'] = this.stockAvailability;
    data['stock_availabilityn'] = this.stockAvailabilityn;
    data['allow_back_in_stock_subscriptions'] =
        this.allowBackInStockSubscriptions;
    data['order_minimum_quantity'] = this.orderMinimumQuantity;
    data['order_maximum_quantity'] = this.orderMaximumQuantity;
    data['price'] = this.price;
    data['old_price'] = this.oldPrice;
    data['discount_name'] = this.discountName;
    data['discount_namen'] = this.discountNamen;
    data['discount_percentage'] = this.discountPercentage;
    data['display_order'] = this.displayOrder;

    if (this.images != null) {
      data['images'] = this.images.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class LocalizedNames {
  int languageId;
  String localizedName;

  LocalizedNames({this.languageId, this.localizedName});

  LocalizedNames.fromJson(Map<String, dynamic> json) {
    languageId = json['language_id'];
    localizedName = json['localized_name'];
  }

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

class Images {
  int id;
  int position;
  String src;
  String thumb;
  String attachment;

  Images({this.id, this.position, this.src, this.thumb, this.attachment});

  Images.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    position = json['position'];
    src = json['src'];
    thumb = json['thumb'];
    attachment = json['attachment'];
  }

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