// // To parse this JSON data, do
// //
// //     final allProductModel = allProductModelFromJson(jsondynamic);

// import 'dart:convert';

// AllProductModel allProductModelFromJson(dynamic str) =>
//     AllProductModel.fromJson(json.decode(str));

// dynamic allProductModelToJson(AllProductModel data) =>
//     json.encode(data.toJson());

// class AllProductModel {
//   List<Product>? data;
//   Meta? meta;

//   AllProductModel({
//     this.data,
//     this.meta,
//   });

//   factory AllProductModel.fromJson(Map<dynamic, dynamic> json) =>
//       AllProductModel(
//         data: List<Product>.from(json["data"].map((x) => Product.fromJson(x))),
//         meta: Meta.fromJson(json["meta"]),
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "data": List<dynamic>.from(data!.map((x) => x.toJson())),
//         "meta": meta!.toJson(),
//       };
// }

// class Product {
//   dynamic id;
//   dynamic name;
//   dynamic description;
//   dynamic additionalInfo;
//   dynamic brand;
//   dynamic basePrice;
//   dynamic discountPrice;
//   dynamic stock;
//   dynamic quantity;
//   dynamic unit;
//   dynamic slug;
//   dynamic rating;
//   bool? isInStock;
//   bool? isActive;
//  DateTime?? createdAt;
//  DateTime?? updatedAt;
//   dynamic storeId;
//   dynamic categoryId;
//   dynamic productTypeId;
//   dynamic timeSlotId;
//   Store? store;
//   Category? category;
//   dynamic productType;
//   dynamic timeSlot;
//   dynamic isInWishlist;
//   List<ProductImage>? productImages;
//   List<dynamic>? productTags;
//   List<dynamic>? zones;
//   List<ProductReview>? productReview;

//   Product(
//       {this.id,
//       this.name,
//       this.description,
//       this.additionalInfo,
//       this.brand,
//       this.basePrice,
//       this.discountPrice,
//       this.stock,
//       this.quantity,
//       this.unit,
//       this.slug,
//       this.rating,
//       this.isInStock,
//       this.isActive,
//       this.createdAt,
//       this.updatedAt,
//       this.storeId,
//       this.categoryId,
//       this.productTypeId,
//       this.timeSlotId,
//       this.store,
//       this.category,
//       this.productType,
//       this.timeSlot,
//       this.productImages,
//       this.productTags,
//       this.zones,
//       this.productReview,
//       this.isInWishlist});

//   factory Product.fromJson(Map<dynamic, dynamic> json) => Product(
//         id: json["id"],
//         name: json["name"],
//         description: json["description"],
//         additionalInfo: json["additionalInfo"],
//         brand: json["brand"],
//         basePrice: json["basePrice"],
//         discountPrice: json["discountPrice"],
//         stock: json["stock"],
//         quantity: json["quantity"],
//         unit: json["unit"],
//         slug: json["slug"],
//         rating: json["rating"],
//         isInStock: json["isInStock"],
//         isActive: json["isActive"],
//         createdAt:DateTime?.parse(json["createdAt"]),
//         updatedAt:DateTime?.parse(json["updatedAt"]),
//         storeId: json["storeId"],
//         categoryId: json["categoryId"],
//         productTypeId: json["productTypeId"],
//         timeSlotId: json["timeSlotId"],
//         store: Store.fromJson(json["store"]),
//         category: Category.fromJson(json["category"]),
//         productType: json["productType"],
//         timeSlot: json["timeSlot"],
//         productImages: List<ProductImage>.from(
//             json["productImages"].map((x) => ProductImage.fromJson(x))),
//         productTags: List<dynamic>.from(json["productTags"].map((x) => x)),
//         zones: List<dynamic>.from(json["zones"].map((x) => x)),
//         productReview: List<ProductReview>.from(
//             json["ProductReview"].map((x) => ProductReview.fromJson(x))),
//         isInWishlist: json["isInWishlist"],
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "name": name,
//         "description": description,
//         "additionalInfo": additionalInfo,
//         "brand": brand,
//         "basePrice": basePrice,
//         "discountPrice": discountPrice,
//         "stock": stock,
//         "quantity": quantity,
//         "unit": unit,
//         "slug": slug,
//         "rating": rating,
//         "isInStock": isInStock,
//         "isActive": isActive,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "storeId": storeId,
//         "categoryId": categoryId,
//         "productTypeId": productTypeId,
//         "timeSlotId": timeSlotId,
//         "store": store!.toJson(),
//         "category": category!.toJson(),
//         "productType": productType,
//         "timeSlot": timeSlot,
//         "productImages":
//             List<dynamic>.from(productImages!.map((x) => x.toJson())),
//         "productTags": List<dynamic>.from(productTags!.map((x) => x)),
//         "zones": List<dynamic>.from(zones!.map((x) => x)),
//         "ProductReview":
//             List<dynamic>.from(productReview!.map((x) => x.toJson())),
//         "isInWishlist": isInWishlist,
//       };

// }

// class Category {
//   dynamic id;
//   dynamic name;
//   dynamic description;
//   dynamic image;
//   dynamic slug;
//   dynamic level;
//   bool? isActive;
//  DateTime?? createdAt;
//  DateTime?? updatedAt;
//   dynamic parentCategoryId;
//   dynamic path;

//   Category({
//     this.id,
//     this.name,
//     this.description,
//     this.image,
//     this.slug,
//     this.level,
//     this.isActive,
//     this.createdAt,
//     this.updatedAt,
//     this.parentCategoryId,
//     this.path,
//   });

//   factory Category.fromJson(Map<dynamic, dynamic> json) => Category(
//         id: json["id"],
//         name: json["name"],
//         description: json["description"],
//         image: json["image"],
//         slug: json["slug"],
//         level: json["level"],
//         isActive: json["isActive"],
//         createdAt:DateTime?.parse(json["createdAt"]),
//         updatedAt:DateTime?.parse(json["updatedAt"]),
//         parentCategoryId: json["parentCategoryId"],
//         path: json["path"],
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "name": name,
//         "description": description,
//         "image": image,
//         "slug": slug,
//         "level": level,
//         "isActive": isActive,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "parentCategoryId": parentCategoryId,
//         "path": path,
//       };
// }

// class ProductImage {
//   dynamic id;
//   dynamic url;
//   bool? isDefault;
//   dynamic productId;

//   ProductImage({
//     this.id,
//     this.url,
//     this.isDefault,
//     this.productId,
//   });

//   factory ProductImage.fromJson(Map<dynamic, dynamic> json) => ProductImage(
//         id: json["id"],
//         url: json["url"],
//         isDefault: json["isDefault"],
//         productId: json["productId"],
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "url": url,
//         "isDefault": isDefault,
//         "productId": productId,
//       };
// }

// class ProductReview {
//   dynamic id;
//   dynamic userId;
//   dynamic productId;
//   dynamic rating;
//   dynamic title;
//   dynamic description;
//   dynamic likes;
//   dynamic dislikes;
//   dynamic helpfulCount;
//   bool? isVerified;
//   bool? verifiedPurchase;
//   dynamic status;
//  DateTime?? createdAt;
//  DateTime?? updatedAt;

//   ProductReview({
//     this.id,
//     this.userId,
//     this.productId,
//     this.rating,
//     this.title,
//     this.description,
//     this.likes,
//     this.dislikes,
//     this.helpfulCount,
//     this.isVerified,
//     this.verifiedPurchase,
//     this.status,
//     this.createdAt,
//     this.updatedAt,
//   });

//   factory ProductReview.fromJson(Map<dynamic, dynamic> json) => ProductReview(
//         id: json["id"],
//         userId: json["userId"],
//         productId: json["productId"],
//         rating: json["rating"],
//         title: json["title"],
//         description: json["description"],
//         likes: json["likes"],
//         dislikes: json["dislikes"],
//         helpfulCount: json["helpfulCount"],
//         isVerified: json["isVerified"],
//         verifiedPurchase: json["verifiedPurchase"],
//         status: json["status"],
//         createdAt:DateTime?.parse(json["createdAt"]),
//         updatedAt:DateTime?.parse(json["updatedAt"]),
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "userId": userId,
//         "productId": productId,
//         "rating": rating,
//         "title": title,
//         "description": description,
//         "likes": likes,
//         "dislikes": dislikes,
//         "helpfulCount": helpfulCount,
//         "isVerified": isVerified,
//         "verifiedPurchase": verifiedPurchase,
//         "status": status,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//       };
// }

// class Store {
//   dynamic id;
//   dynamic storeName;
//   dynamic storeDescription;
//   dynamic officialPhoneNumber;
//   dynamic storeAddress;
//   dynamic gstNumber;
//   dynamic gumastaNumber;
//   dynamic storePicture;
//  DateTime?? createdAt;
//  DateTime?? updatedAt;
//   dynamic vendorId;
//   bool? isActive;

//   Store({
//     this.id,
//     this.storeName,
//     this.storeDescription,
//     this.officialPhoneNumber,
//     this.storeAddress,
//     this.gstNumber,
//     this.gumastaNumber,
//     this.storePicture,
//     this.createdAt,
//     this.updatedAt,
//     this.vendorId,
//     this.isActive,
//   });

//   factory Store.fromJson(Map<dynamic, dynamic> json) => Store(
//         id: json["id"],
//         storeName: json["storeName"],
//         storeDescription: json["storeDescription"],
//         officialPhoneNumber: json["officialPhoneNumber"],
//         storeAddress: json["storeAddress"],
//         gstNumber: json["gstNumber"],
//         gumastaNumber: json["gumastaNumber"],
//         storePicture: json["storePicture"],
//         createdAt:DateTime?.parse(json["createdAt"]),
//         updatedAt:DateTime?.parse(json["updatedAt"]),
//         vendorId: json["vendorId"],
//         isActive: json["isActive"],
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "storeName": storeName,
//         "storeDescription": storeDescription,
//         "officialPhoneNumber": officialPhoneNumber,
//         "storeAddress": storeAddress,
//         "gstNumber": gstNumber,
//         "gumastaNumber": gumastaNumber,
//         "storePicture": storePicture,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "vendorId": vendorId,
//         "isActive": isActive,
//       };
// }

// class Meta {
//   dynamic total;
//   dynamic page;
//   dynamic lastPage;

//   Meta({
//     this.total,
//     this.page,
//     this.lastPage,
//   });

//   factory Meta.fromJson(Map<dynamic, dynamic> json) => Meta(
//         total: json["total"],
//         page: json["page"],
//         lastPage: json["lastPage"],
//       );

//   Map<dynamic, dynamic> toJson() => {
//         "total": total,
//         "page": page,
//         "lastPage": lastPage,
//       };
// }

// To parse this JSON data, do
//
//     final allProductModel = allProductModelFromJson(jsondynamic);

import 'dart:convert';

AllProductModel allProductModelFromJson(dynamic str) =>
    AllProductModel.fromJson(json.decode(str));

dynamic allProductModelToJson(AllProductModel data) =>
    json.encode(data.toJson());

class AllProductModel {
  List<Product>? data;
  Meta? meta;

  AllProductModel({
    this.data,
    this.meta,
  });

  factory AllProductModel.fromJson(Map<dynamic, dynamic> json) =>
      AllProductModel(
        data: List<Product>.from(json["data"].map((x) => Product.fromJson(x))),
        meta: Meta.fromJson(json["meta"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "data": List<dynamic>.from(data!.map((x) => x.toJson())),
        "meta": meta!.toJson(),
      };
}

class Product {
  dynamic id;
  dynamic name;
  dynamic description;
  dynamic additionalInfo;
  dynamic brand;
  dynamic basePrice;
  dynamic discountPrice;
  dynamic stock;
  dynamic quantity;
  dynamic unit;
  dynamic slug;
  dynamic averageRating;
  dynamic isInStock;
  dynamic isActive;
  dynamic disclaimer;
  dynamic customerCareDetails;
  dynamic manufacturerName;
  dynamic manufacturerAddress;
  dynamic countryOfOrigin;
  dynamic expiryDate;
  dynamic returnsAllowedDays;
  dynamic exchangeAllowedDays;
  dynamic? createdAt;
  dynamic? updatedAt;
  dynamic storeId;
  dynamic categoryId;
  dynamic productTypeId;
  dynamic timeSlotId;
  Store? store;
  Category? category;
  dynamic productType;
  dynamic timeSlot;
  List<ProductImage>? productImages;
  List<ProductTag>? productTags;
  List<dynamic>? zones;
  List<ProductHighlight>? productHighlight;
  List<ProductReview>? productReview;
  List<dynamic>? questions;
  List<CartItem>? cartItems;
  List<WishlistItem>? wishlistItem;
  List<dynamic>? applicableCoupons;

  Product({
    this.id,
    this.name,
    this.description,
    this.additionalInfo,
    this.brand,
    this.basePrice,
    this.discountPrice,
    this.stock,
    this.quantity,
    this.unit,
    this.slug,
    this.averageRating,
    this.isInStock,
    this.isActive,
    this.disclaimer,
    this.customerCareDetails,
    this.manufacturerName,
    this.manufacturerAddress,
    this.countryOfOrigin,
    this.expiryDate,
    this.returnsAllowedDays,
    this.exchangeAllowedDays,
    this.createdAt,
    this.updatedAt,
    this.storeId,
    this.categoryId,
    this.productTypeId,
    this.timeSlotId,
    this.store,
    this.category,
    this.productType,
    this.timeSlot,
    this.productImages,
    this.productTags,
    this.zones,
    this.productHighlight,
    this.productReview,
    this.questions,
    this.cartItems,
    this.wishlistItem,
    this.applicableCoupons,
  });

  factory Product.fromJson(Map<String, dynamic> json) => Product(
        id: json["id"],
        name: json["name"] ?? "",
        description: json["description"] ?? "",
        additionalInfo: json["additionalInfo"],
        brand: json["brand"],
        basePrice: json["basePrice"],
        discountPrice: json["discountPrice"],
        stock: json["stock"],
        quantity: json["quantity"],
        unit: json["unit"],
        slug: json["slug"],
        averageRating: json["averageRating"],
        isInStock: json["isInStock"],
        isActive: json["isActive"],
        disclaimer: json["disclaimer"],
        customerCareDetails: json["customerCareDetails"],
        manufacturerName: json["manufacturerName"],
        manufacturerAddress: json["manufacturerAddress"],
        countryOfOrigin: json["countryOfOrigin"],
        expiryDate: json["expiryDate"] != null
            ? DateTime.parse(json["expiryDate"])
            : null,
        createdAt: json["createdAt"] != null
            ? DateTime.parse(json["createdAt"])
            : null,
        updatedAt: json["updatedAt"] != null
            ? DateTime.parse(json["updatedAt"])
            : null,
        returnsAllowedDays: json["returnsAllowedDays"],
        exchangeAllowedDays: json["exchangeAllowedDays"],
        productTags: json["productTags"] != null
            ? List<ProductTag>.from(
                json["productTags"].map((x) => ProductTag.fromJson(x)))
            : [],
        storeId: json["storeId"],
        categoryId: json["categoryId"],
        productTypeId: json["productTypeId"],
        timeSlotId: json["timeSlotId"],
        store: Store.fromJson(json["store"]),
        category: Category.fromJson(json["category"]),
        productType: json["productType"],
        timeSlot: json["timeSlot"],
        productImages: List<ProductImage>.from(
            json["productImages"].map((x) => ProductImage.fromJson(x))),
        zones: List<dynamic>.from(json["zones"].map((x) => x)),
        productHighlight: List<ProductHighlight>.from(
            json["ProductHighlight"].map((x) => ProductHighlight.fromJson(x))),
        productReview: List<ProductReview>.from(
            json["ProductReview"].map((x) => ProductReview.fromJson(x))),
        questions: List<dynamic>.from(json["questions"].map((x) => x)),
        cartItems: List<CartItem>.from(
            json["cartItems"].map((x) => CartItem.fromJson(x))),
        wishlistItem: List<WishlistItem>.from(
            json["WishlistItem"].map((x) => WishlistItem.fromJson(x))),
        applicableCoupons:
            List<dynamic>.from(json["applicableCoupons"].map((x) => x)),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "name": name,
        "description": description,
        "additionalInfo": additionalInfo,
        "brand": brand,
        "basePrice": basePrice,
        "discountPrice": discountPrice,
        "stock": stock,
        "quantity": quantity,
        "unit": unit,
        "slug": slug,
        "averageRating": averageRating,
        "isInStock": isInStock,
        "isActive": isActive,
        "disclaimer": disclaimer,
        "customerCareDetails": customerCareDetails,
        "manufacturerName": manufacturerName,
        "manufacturerAddress": manufacturerAddress,
        "countryOfOrigin": countryOfOrigin,
        "expiryDate": expiryDate,
        "returnsAllowedDays": returnsAllowedDays,
        "exchangeAllowedDays": exchangeAllowedDays,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "storeId": storeId,
        "categoryId": categoryId,
        "productTypeId": productTypeId,
        "timeSlotId": timeSlotId,
        "store": store!.toJson(),
        "category": category!.toJson(),
        "productType": productType,
        "timeSlot": timeSlot,
        "productImages":
            List<dynamic>.from(productImages!.map((x) => x.toJson())),
        "productTags": List<dynamic>.from(productTags!.map((x) => x.toJson())),
        "zones": List<dynamic>.from(zones!.map((x) => x)),
        "ProductHighlight":
            List<dynamic>.from(productHighlight!.map((x) => x.toJson())),
        "ProductReview":
            List<dynamic>.from(productReview!.map((x) => x.toJson())),
        "questions": List<dynamic>.from(questions!.map((x) => x)),
        "cartItems": List<dynamic>.from(cartItems!.map((x) => x.toJson())),
        "WishlistItem":
            List<dynamic>.from(wishlistItem!.map((x) => x.toJson())),
        "applicableCoupons":
            List<dynamic>.from(applicableCoupons!.map((x) => x)),
      };
}

class CartItem {
  dynamic id;
  dynamic quantity;
  dynamic priceSnapshot;
  dynamic cartId;
  dynamic productId;
  dynamic storeId;
  DateTime? createdAt;
  DateTime? updatedAt;

  CartItem({
    this.id,
    this.quantity,
    this.priceSnapshot,
    this.cartId,
    this.productId,
    this.storeId,
    this.createdAt,
    this.updatedAt,
  });

  factory CartItem.fromJson(Map<dynamic, dynamic> json) => CartItem(
        id: json["id"],
        quantity: json["quantity"],
        priceSnapshot: json["priceSnapshot"],
        cartId: json["cartId"],
        productId: idValues.map[json["productId"]],
        storeId: json["storeId"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "quantity": quantity,
        "priceSnapshot": priceSnapshot,
        "cartId": cartId,
        "productId": idValues.reverse[productId],
        "storeId": storeId,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
      };
}

enum Id { CM6_X4_PQQN0000_UYFOBAI380_ED, CM6_X5_O33_O000_OUYFO0_Y5_K28_IU }

final idValues = EnumValues({
  "cm6x4pqqn0000uyfobai380ed": Id.CM6_X4_PQQN0000_UYFOBAI380_ED,
  "cm6x5o33o000ouyfo0y5k28iu": Id.CM6_X5_O33_O000_OUYFO0_Y5_K28_IU
});

class Category {
  dynamic id;
  dynamic name;
  dynamic description;
  dynamic image;
  dynamic slug;
  dynamic level;
  dynamic isActive;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic commissionPercentage;
  dynamic parentCategoryId;
  dynamic path;

  Category({
    this.id,
    this.name,
    this.description,
    this.image,
    this.slug,
    this.level,
    this.isActive,
    this.createdAt,
    this.updatedAt,
    this.commissionPercentage,
    this.parentCategoryId,
    this.path,
  });

  factory Category.fromJson(Map<dynamic, dynamic> json) => Category(
        id: json["id"],
        name: json["name"],
        description: json["description"],
        image: json["image"],
        slug: json["slug"],
        level: json["level"],
        isActive: json["isActive"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
        commissionPercentage: json["commissionPercentage"],
        parentCategoryId: json["parentCategoryId"],
        path: json["path"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "name": name,
        "description": description,
        "image": image,
        "slug": slug,
        "level": level,
        "isActive": isActive,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "commissionPercentage": commissionPercentage,
        "parentCategoryId": parentCategoryId,
        "path": path,
      };
}

class ProductHighlight {
  dynamic id;
  dynamic key;
  dynamic value;
  dynamic productId;
  DateTime? createdAt;
  DateTime? updatedAt;

  ProductHighlight({
    this.id,
    this.key,
    this.value,
    this.productId,
    this.createdAt,
    this.updatedAt,
  });

  factory ProductHighlight.fromJson(Map<dynamic, dynamic> json) =>
      ProductHighlight(
        id: json["id"],
        key: json["key"],
        value: json["value"],
        productId: idValues.map[json["productId"]],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "key": key,
        "value": value,
        "productId": idValues.reverse[productId],
        "createdAt": createdAt,
        "updatedAt": updatedAt,
      };
}

class ProductImage {
  dynamic id;
  dynamic url;
  dynamic isDefault;
  dynamic productId;

  ProductImage({
    this.id,
    this.url,
    this.isDefault,
    this.productId,
  });

  factory ProductImage.fromJson(Map<dynamic, dynamic> json) => ProductImage(
        id: json["id"],
        url: json["url"],
        isDefault: json["isDefault"],
        productId: idValues.map[json["productId"]],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "url": url,
        "isDefault": isDefault,
        "productId": idValues.reverse[productId],
      };
}

class ProductReview {
  dynamic id;
  dynamic userId;
  dynamic productId;
  dynamic rating;
  dynamic title;
  dynamic description;
  dynamic likes;
  dynamic dislikes;
  dynamic helpfulCount;
  dynamic verifiedPurchase;
  dynamic status;
  DateTime? createdAt;
  DateTime? updatedAt;
  User? user;
  List<ProductReviewImage>? productReviewImage;

  ProductReview({
    this.id,
    this.userId,
    this.productId,
    this.rating,
    this.title,
    this.description,
    this.likes,
    this.dislikes,
    this.helpfulCount,
    this.verifiedPurchase,
    this.status,
    this.createdAt,
    this.updatedAt,
    this.user,
    this.productReviewImage,
  });

  factory ProductReview.fromJson(Map<dynamic, dynamic> json) => ProductReview(
        id: json["id"],
        userId: json["userId"],
        productId: idValues.map[json["productId"]],
        rating: json["rating"],
        title: json["title"],
        description: json["description"],
        likes: json["likes"],
        dislikes: json["dislikes"],
        helpfulCount: json["helpfulCount"],
        verifiedPurchase: json["verifiedPurchase"],
        status: json["status"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
        user: User.fromJson(json["user"]),
        productReviewImage: List<ProductReviewImage>.from(
            json["ProductReviewImage"]
                .map((x) => ProductReviewImage.fromJson(x))),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "userId": userId,
        "productId": idValues.reverse[productId],
        "rating": rating,
        "title": title,
        "description": description,
        "likes": likes,
        "dislikes": dislikes,
        "helpfulCount": helpfulCount,
        "verifiedPurchase": verifiedPurchase,
        "status": status,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "user": user!.toJson(),
        "ProductReviewImage":
            List<dynamic>.from(productReviewImage!.map((x) => x.toJson())),
      };
}

class ProductReviewImage {
  dynamic id;
  dynamic reviewId;
  dynamic imageUrl;
  dynamic isDefault;
  DateTime? createdAt;

  ProductReviewImage({
    this.id,
    this.reviewId,
    this.imageUrl,
    this.isDefault,
    this.createdAt,
  });

  factory ProductReviewImage.fromJson(Map<dynamic, dynamic> json) =>
      ProductReviewImage(
        id: json["id"],
        reviewId: json["reviewId"],
        imageUrl: json["imageUrl"],
        isDefault: json["isDefault"],
        createdAt: DateTime?.parse(json["createdAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "reviewId": reviewId,
        "imageUrl": imageUrl,
        "isDefault": isDefault,
        "createdAt": createdAt,
      };
}

class User {
  dynamic id;
  dynamic email;
  dynamic firstName;
  dynamic lastName;
  dynamic name;
  dynamic img;
  dynamic authType;
  dynamic role;
  dynamic phone;
  dynamic password;
  dynamic isActive;
  dynamic isPhoneVerified;
  dynamic vendorType;
  dynamic businessId;
  dynamic isVendorAccountCreated;
  dynamic isVendorAccountActive;
  dynamic vendorTermsAccepted;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic rtHash;
  dynamic resetToken;
  dynamic resetTokenExpiresAt;

  User({
    this.id,
    this.email,
    this.firstName,
    this.lastName,
    this.name,
    this.img,
    this.authType,
    this.role,
    this.phone,
    this.password,
    this.isActive,
    this.isPhoneVerified,
    this.vendorType,
    this.businessId,
    this.isVendorAccountCreated,
    this.isVendorAccountActive,
    this.vendorTermsAccepted,
    this.createdAt,
    this.updatedAt,
    this.rtHash,
    this.resetToken,
    this.resetTokenExpiresAt,
  });

  factory User.fromJson(Map<dynamic, dynamic> json) => User(
        id: json["id"],
        email: json["email"],
        firstName: json["firstName"],
        lastName: json["lastName"],
        name: json["name"],
        img: json["img"],
        authType: json["authType"],
        role: json["role"],
        phone: json["phone"],
        password: json["password"],
        isActive: json["isActive"],
        isPhoneVerified: json["isPhoneVerified"],
        vendorType: json["vendorType"],
        businessId: json["businessId"],
        isVendorAccountCreated: json["isVendorAccountCreated"],
        isVendorAccountActive: json["isVendorAccountActive"],
        vendorTermsAccepted: json["vendorTermsAccepted"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
        rtHash: json["rtHash"],
        resetToken: json["resetToken"],
        resetTokenExpiresAt: json["resetTokenExpiresAt"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "email": email,
        "firstName": firstName,
        "lastName": lastName,
        "name": name,
        "img": img,
        "authType": authType,
        "role": role,
        "phone": phone,
        "password": password,
        "isActive": isActive,
        "isPhoneVerified": isPhoneVerified,
        "vendorType": vendorType,
        "businessId": businessId,
        "isVendorAccountCreated": isVendorAccountCreated,
        "isVendorAccountActive": isVendorAccountActive,
        "vendorTermsAccepted": vendorTermsAccepted,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "rtHash": rtHash,
        "resetToken": resetToken,
        "resetTokenExpiresAt": resetTokenExpiresAt,
      };
}

class ProductTag {
  dynamic id;
  dynamic name;
  dynamic description;
  dynamic isActive;
  DateTime? createdAt;
  DateTime? updatedAt;

  ProductTag({
    this.id,
    this.name,
    this.description,
    this.isActive,
    this.createdAt,
    this.updatedAt,
  });

  factory ProductTag.fromJson(Map<dynamic, dynamic> json) => ProductTag(
        id: json["id"],
        name: json["name"],
        description: descriptionValues.map[json["description"]],
        isActive: json["isActive"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "name": name,
        "description": descriptionValues.reverse[description],
        "isActive": isActive,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
      };
}

enum Description { BEST_PRODUCT, SAMSUNG_PHONES, TOP_PRODUCT }

final descriptionValues = EnumValues({
  "best product": Description.BEST_PRODUCT,
  "Samsung phones \ud83d\udc96": Description.SAMSUNG_PHONES,
  "top product": Description.TOP_PRODUCT
});

class Store {
  dynamic id;
  dynamic storeName;
  dynamic storePicture;
  dynamic storeAddress;
  dynamic officialPhoneNumber;
  dynamic sellerLicenseNumber;
  Vendor? vendor;

  Store({
    this.id,
    this.storeName,
    this.storePicture,
    this.storeAddress,
    this.officialPhoneNumber,
    this.sellerLicenseNumber,
    this.vendor,
  });

  factory Store.fromJson(Map<dynamic, dynamic> json) => Store(
        id: json["id"],
        storeName: json["storeName"],
        storePicture: json["storePicture"],
        storeAddress: json["storeAddress"],
        officialPhoneNumber: json["officialPhoneNumber"],
        sellerLicenseNumber: json["sellerLicenseNumber"],
        vendor: Vendor.fromJson(json["vendor"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "storeName": storeName,
        "storePicture": storePicture,
        "storeAddress": storeAddress,
        "officialPhoneNumber": officialPhoneNumber,
        "sellerLicenseNumber": sellerLicenseNumber,
        "vendor": vendor!.toJson(),
      };
}

class Vendor {
  dynamic id;
  dynamic email;
  dynamic firstName;
  dynamic lastName;
  dynamic phone;

  Vendor({
    this.id,
    this.email,
    this.firstName,
    this.lastName,
    this.phone,
  });

  factory Vendor.fromJson(Map<dynamic, dynamic> json) => Vendor(
        id: json["id"],
        email: json["email"],
        firstName: json["firstName"],
        lastName: json["lastName"],
        phone: json["phone"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "email": email,
        "firstName": firstName,
        "lastName": lastName,
        "phone": phone,
      };
}

class WishlistItem {
  dynamic id;
  dynamic wishlistId;
  dynamic productId;
  dynamic storeId;
  DateTime? createdAt;
  DateTime? updatedAt;

  WishlistItem({
    this.id,
    this.wishlistId,
    this.productId,
    this.storeId,
    this.createdAt,
    this.updatedAt,
  });

  factory WishlistItem.fromJson(Map<dynamic, dynamic> json) => WishlistItem(
        id: json["id"],
        wishlistId: json["wishlistId"],
        productId: idValues.map[json["productId"]],
        storeId: json["storeId"],
        createdAt: DateTime?.parse(json["createdAt"]),
        updatedAt: DateTime?.parse(json["updatedAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "wishlistId": wishlistId,
        "productId": idValues.reverse[productId],
        "storeId": storeId,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
      };
}

class Meta {
  dynamic total;
  dynamic page;
  dynamic lastPage;

  Meta({
    this.total,
    this.page,
    this.lastPage,
  });

  factory Meta.fromJson(Map<dynamic, dynamic> json) => Meta(
        total: json["total"],
        page: json["page"],
        lastPage: json["lastPage"],
      );

  Map<dynamic, dynamic> toJson() => {
        "total": total,
        "page": page,
        "lastPage": lastPage,
      };
}

class EnumValues<T> {
  Map<dynamic, T> map;
  late Map<T, dynamic> reverseMap;

  EnumValues(this.map);

  Map<T, dynamic> get reverse {
    reverseMap = map.map((k, v) => MapEntry(v, k));
    return reverseMap;
  }
}
