// import 'dart:convert';

// CheckProduct checkProductFromJson(String str) =>
//     CheckProduct.fromJson(json.decode(str));

// String checkProductToJson(CheckProduct data) => json.encode(data.toJson());

// class CheckProduct {
//   double? maxDistance;
//   int? maxDeliveryCharges;
//   List<Distance>? distances;
//   // List<NonDeliverableProduct>? nonDeliverableProducts;
//   bool? isDeliverable;

//   CheckProduct({
//     this.maxDistance,
//     this.maxDeliveryCharges,
//     this.distances,
//     //  this.nonDeliverableProducts,
//     this.isDeliverable,
//   });

//   factory CheckProduct.fromJson(Map<String, dynamic> json) => CheckProduct(
//         maxDistance: json["maxDistance"].toDouble(),
//         maxDeliveryCharges: json["maxDeliveryCharges"],
//         distances: List<Distance>.from(
//             json["distances"].map((x) => Distance.fromJson(x))),
//         // nonDeliverableProducts: List<NonDeliverableProduct>.from(
//         //     json["nonDeliverableProducts"]
//         //         .map((x) => NonDeliverableProduct.fromJson(x))),
//         isDeliverable: json["isDeliverable"],
//       );

//   Map<String, dynamic> toJson() => {
//         "maxDistance": maxDistance,
//         "maxDeliveryCharges": maxDeliveryCharges,
//         "distances": List<dynamic>.from(distances!.map((x) => x.toJson())),
//         // "nonDeliverableProducts":
//         //     List<dynamic>.from(nonDeliverableProducts!.map((x) => x.toJson())),
//         "isDeliverable": isDeliverable,
//       };
// }

// class Distance {
//   int? rank;
//   String? productId;
//   String? categoryId;
//   double? distance;
//   String? productName;
//   String? productDescription;
//   String? productImage;
//   String? maxDeliveryCharges;

//   Distance({
//     this.rank,
//     this.productId,
//     this.categoryId,
//     this.distance,
//     this.productName,
//     this.productDescription,
//     this.productImage,
//     this.maxDeliveryCharges,
//   });

//   factory Distance.fromJson(Map<String, dynamic> json) => Distance(
//         rank: json["rank"],
//         productId: json["productId"],
//         categoryId: json["categoryId"],
//         distance: json["distance"].toDouble(),
//         productName: json["productName"],
//         productDescription: json["productDescription"],
//         productImage: json["productImage"],
//         maxDeliveryCharges: json["maxDeliveryCharges"],
//       );

//   Map<String, dynamic> toJson() => {
//         "rank": rank,
//         "productId": productId,
//         "categoryId": categoryId,
//         "distance": distance,
//         "productName": productName,
//         "productDescription": productDescription,
//         "productImage": productImage,
//         "maxDeliveryCharges": maxDeliveryCharges,
//       };
// }

// class NonDeliverableProduct {
//   String? productId;
//   String? productName;
//   String? productDescription;
//   String? productImage;
//   double? distance;

//   NonDeliverableProduct({
//     this.productId,
//     this.productName,
//     this.productDescription,
//     this.productImage,
//     this.distance,
//   });

//   factory NonDeliverableProduct.fromJson(Map<String, dynamic> json) =>
//       NonDeliverableProduct(
//         productId: json["productId"],
//         productName: json["productName"],
//         productDescription: json["productDescription"],
//         productImage: json["productImage"],
//         distance: json["distance"].toDouble(),
//       );

//   Map<String, dynamic> toJson() => {
//         "productId": productId,
//         "productName": productName,
//         "productDescription": productDescription,
//         "productImage": productImage,
//         "distance": distance,
//       };
// }

// To parse this JSON data, do
//
//     final checkProduct = checkProductFromJson(jsonString);

import 'dart:convert';

CheckProduct checkProductFromJson(String str) =>
    CheckProduct.fromJson(json.decode(str));

String checkProductToJson(CheckProduct data) => json.encode(data.toJson());

class CheckProduct {
  double? maxDistance;
  int? maxDeliveryCharges;
  List<Distance>? distances;
  List<dynamic>? nonDeliverableProducts;
  bool? isDeliverable;

  CheckProduct({
    this.maxDistance,
    this.maxDeliveryCharges,
    this.distances,
    this.nonDeliverableProducts,
    this.isDeliverable,
  });

  factory CheckProduct.fromJson(Map<String, dynamic> json) => CheckProduct(
        maxDistance: json["maxDistance"].toDouble(),
        maxDeliveryCharges: json["maxDeliveryCharges"],
        distances: List<Distance>.from(
            json["distances"].map((x) => Distance.fromJson(x))),
        nonDeliverableProducts:
            List<dynamic>.from(json["nonDeliverableProducts"].map((x) => x)),
        isDeliverable: json["isDeliverable"],
      );

  Map<String, dynamic> toJson() => {
        "maxDistance": maxDistance,
        "maxDeliveryCharges": maxDeliveryCharges,
        "distances": List<dynamic>.from(distances!.map((x) => x.toJson())),
        "nonDeliverableProducts":
            List<dynamic>.from(nonDeliverableProducts!.map((x) => x)),
        "isDeliverable": isDeliverable,
      };
}

class Distance {
  int? rank;
  String? productId;
  String? categoryId;
  double? distance;
  String? productName;
  String? productDescription;
  String? productImage;
  int? maxDeliveryCharges;

  Distance({
    this.rank,
    this.productId,
    this.categoryId,
    this.distance,
    this.productName,
    this.productDescription,
    this.productImage,
    this.maxDeliveryCharges,
  });

  factory Distance.fromJson(Map<String, dynamic> json) => Distance(
        rank: json["rank"],
        productId: json["productId"],
        categoryId: json["categoryId"],
        distance: json["distance"].toDouble(),
        productName: json["productName"],
        productDescription: json["productDescription"],
        productImage: json["productImage"],
        maxDeliveryCharges: json["maxDeliveryCharges"],
      );

  Map<String, dynamic> toJson() => {
        "rank": rank,
        "productId": productId,
        "categoryId": categoryId,
        "distance": distance,
        "productName": productName,
        "productDescription": productDescription,
        "productImage": productImage,
        "maxDeliveryCharges": maxDeliveryCharges,
      };
}
