class ProductDetails {
  int? code;
  List<Product>? products;
  String? message;
  Pricedetails? pricedetails;
  bool? status;

  ProductDetails({
    this.code,
    this.products,
    this.message,
    this.pricedetails,
    this.status,
  });

  factory ProductDetails.fromJson(Map<String, dynamic> json) {
    return ProductDetails(
      code: json['code'] as int?,
      products: json['details'] != null
          ? (json['details'] as List<dynamic>)
          .map((v) => Product.fromJson(v as Map<String, dynamic>))
          .toList()
          : null,
      message: json['message'] as String?,
      pricedetails: json['pricedetails'] != null
          ? Pricedetails.fromJson(json['pricedetails'] as Map<String, dynamic>)
          : null,
      status: json['status'] as bool?,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['code'] = code;
    if (products != null) {
      data['details'] = products!.map((v) => v.toJson()).toList();
    }
    data['message'] = message;
    if (pricedetails != null) {
      data['pricedetails'] = pricedetails!.toJson();
    }
    data['status'] = status;
    return data;
  }
}

class Product {
  int? orderDetailId;
  int? orderHeaderId;
  int? tenantId;
  int? locationId;
  int? productId;
  String? productName;
  String? productDescription;
  int? supplyQty;
  int? balanceQty;
  int? orderQty;
  int? price;
  int? unitId;
  String? unitName;
  int? productAddonId;
  int? addonTypeId;
  int? productMapId;
  int? productVariantId;
  String? productAddonDescription;
  int? discountId;
  String? discountName;
  String? discountCode;
  String? discountTerms;
  int? discountPercentage;
  int? discountAmount;
  int? landingAmount;
  int? taxPercentage;
  int? taxAmount;
  int? productSumPrice;
  String? itemStatus;
  String? delivered;
  int? orderAmount;
  String? productImage;

  Product({
    this.orderDetailId,
    this.orderHeaderId,
    this.tenantId,
    this.locationId,
    this.productId,
    this.productName,
    this.productDescription,
    this.supplyQty,
    this.balanceQty,
    this.orderQty,
    this.price,
    this.unitId,
    this.unitName,
    this.productAddonId,
    this.addonTypeId,
    this.productMapId,
    this.productVariantId,
    this.productAddonDescription,
    this.discountId,
    this.discountName,
    this.discountCode,
    this.discountTerms,
    this.discountPercentage,
    this.discountAmount,
    this.landingAmount,
    this.taxPercentage,
    this.taxAmount,
    this.productSumPrice,
    this.itemStatus,
    this.delivered,
    this.orderAmount,
    this.productImage,
  });

  factory Product.fromJson(Map<String, dynamic> json) {
    return Product(
      orderDetailId: json['orderdetailid'] as int?,
      orderHeaderId: json['orderheaderid'] as int?,
      tenantId: json['tenantid'] as int?,
      locationId: json['locationid'] as int?,
      productId: json['productid'] as int?,
      productName: json['productname'] as String?,
      productDescription: json['productdescription'] as String?,
      supplyQty: json['supplyqty'] as int?,
      balanceQty: json['balanceqty'] as int?,
      orderQty: json['orderqty'] as int?,
      price: json['price'] as int?,
      unitId: json['unitid'] as int?,
      unitName: json['unitname'] as String?,
      productAddonId: json['productaddonid'] as int?,
      addonTypeId: json['addontypeid'] as int?,
      productMapId: json['productmapid'] as int?,
      productVariantId: json['productvariantid'] as int?,
      productAddonDescription: json['productaddondescription'] as String?,
      discountId: json['discountid'] as int?,
      discountName: json['discountname'] as String?,
      discountCode: json['discountcode'] as String?,
      discountTerms: json['discountterms'] as String?,
      discountPercentage: json['discountpercentage'] as int?,
      discountAmount: json['discountamount'] as int?,
      landingAmount: json['landingamount'] as int?,
      taxPercentage: json['taxpercentage'] as int?,
      taxAmount: json['taxamount'] as int?,
      productSumPrice: json['productsumprice'] as int?,
      itemStatus: json['itemstatus'] as String?,
      delivered: json['delivered'] as String?,
      orderAmount: json['orderamount'] as int?,
      productImage: json['productimage'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['orderdetailid'] = orderDetailId;
    data['orderheaderid'] = orderHeaderId;
    data['tenantid'] = tenantId;
    data['locationid'] = locationId;
    data['productid'] = productId;
    data['productname'] = productName;
    data['productdescription'] = productDescription;
    data['supplyqty'] = supplyQty;
    data['balanceqty'] = balanceQty;
    data['orderqty'] = orderQty;
    data['price'] = price;
    data['unitid'] = unitId;
    data['unitname'] = unitName;
    data['productaddonid'] = productAddonId;
    data['addontypeid'] = addonTypeId;
    data['productmapid'] = productMapId;
    data['productvariantid'] = productVariantId;
    data['productaddondescription'] = productAddonDescription;
    data['discountid'] = discountId;
    data['discountname'] = discountName;
    data['discountcode'] = discountCode;
    data['discountterms'] = discountTerms;
    data['discountpercentage'] = discountPercentage;
    data['discountamount'] = discountAmount;
    data['landingamount'] = landingAmount;
    data['taxpercentage'] = taxPercentage;
    data['taxamount'] = taxAmount;
    data['productsumprice'] = productSumPrice;
    data['itemstatus'] = itemStatus;
    data['delivered'] = delivered;
    data['orderamount'] = orderAmount;
    data['productimage'] = productImage;
    return data;
  }
}

class Pricedetails {
  int? orderAmount;

  Pricedetails({this.orderAmount});

  factory Pricedetails.fromJson(Map<String, dynamic> json) {
    return Pricedetails(
      orderAmount: json['orderamount'] as int?,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['orderamount'] = orderAmount;
    return data;
  }
}