// import 'dart:convert';

// MyOrder myOrderFromJson(dynamic str) => MyOrder.fromJson(json.decode(str));

// dynamic myOrderToJson(MyOrder data) => json.encode(data.toJson());

// class MyOrder {
//     List<Datum>? data;
//     Meta? meta;

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

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

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

// class Datum {
//     dynamic id;
//     dynamic orderNumber;
//     dynamic userId;
//     dynamic totalItems;
//     dynamic subtotal;
//     dynamic deliveryCharge;
//     dynamic paymentMethod;
//     dynamic paymentStatus;
//     dynamic transactionId;
//     dynamic orderStatus;
//     dynamic deliveryAddressId;
//     dynamic couponId;
//     dynamic cancelReason;
//     dynamic cancelledBy;
//     dynamic cancelledAt;
//     DateTime? createdAt;
//     DateTime? updatedAt;
//     User? user;
//     DeliveryAddress? deliveryAddress;
//     List<OrderItem>? orderItems;
//     List<StatusHistory>? statusHistory;

//     Datum({
//         this.id,
//         this.orderNumber,
//         this.userId,
//         this.totalItems,
//         this.subtotal,
//         this.deliveryCharge,
//         this.paymentMethod,
//         this.paymentStatus,
//         this.transactionId,
//         this.orderStatus,
//         this.deliveryAddressId,
//         this.couponId,
//         this.cancelReason,
//         this.cancelledBy,
//         this.cancelledAt,
//         this.createdAt,
//         this.updatedAt,
//         this.user,
//         this.deliveryAddress,
//         this.orderItems,
//         this.statusHistory,
//     });

//     factory Datum.fromJson(Map<dynamic, dynamic> json) => Datum(
//         id: json["id"],
//         orderNumber: json["orderNumber"],
//         userId: json["userId"],
//         totalItems: json["totalItems"],
//         subtotal: json["subtotal"],
//         deliveryCharge: json["deliveryCharge"],
//         paymentMethod: json["paymentMethod"],
//         paymentStatus: json["paymentStatus"],
//         transactionId: json["transactionId"],
//         orderStatus: json["orderStatus"],
//         deliveryAddressId: json["deliveryAddressId"],
//         couponId: json["couponId"],
//         cancelReason: json["cancelReason"],
//         cancelledBy: json["cancelledBy"],
//         cancelledAt: json["cancelledAt"],
//         createdAt: DateTime.parse(json["createdAt"]),
//         updatedAt: DateTime.parse(json["updatedAt"]),
//         user: User.fromJson(json["user"]),
//         deliveryAddress: DeliveryAddress.fromJson(json["deliveryAddress"]),
//         orderItems: List<OrderItem>.from(json["orderItems"].map((x) => OrderItem.fromJson(x))),
//         statusHistory: List<StatusHistory>.from(json["statusHistory"].map((x) => StatusHistory.fromJson(x))),
//     );

//     Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "orderNumber": orderNumber,
//         "userId": userId,
//         "totalItems": totalItems,
//         "subtotal": subtotal,
//         "deliveryCharge": deliveryCharge,
//         "paymentMethod": paymentMethod,
//         "paymentStatus": paymentStatus,
//         "transactionId": transactionId,
//         "orderStatus": orderStatus,
//         "deliveryAddressId": deliveryAddressId,
//         "couponId": couponId,
//         "cancelReason": cancelReason,
//         "cancelledBy": cancelledBy,
//         "cancelledAt": cancelledAt,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "user": user!.toJson(),
//         "deliveryAddress": deliveryAddress!.toJson(),
//         "orderItems": List<dynamic>.from(orderItems!.map((x) => x.toJson())),
//         "statusHistory": List<dynamic>.from(statusHistory!.map((x) => x.toJson())),
//     };
// }

// class DeliveryAddress {
//     dynamic id;
//     dynamic pincode;
//     dynamic phoneNumber;
//     dynamic alternatePhoneNumber;
//     dynamic addressLine;
//     dynamic landmark;
//     dynamic addressType;
//     dynamic city;
//     dynamic district;
//     dynamic name;
//     dynamic state;
//     dynamic country;
//     bool? isDeliverable;
//     bool? isDefault;
//     dynamic additionalInstructions;
//     DateTime? createdAt;
//     DateTime? updatedAt;
//     dynamic userId;

//     DeliveryAddress({
//         this.id,
//         this.pincode,
//         this.phoneNumber,
//         this.alternatePhoneNumber,
//         this.addressLine,
//         this.landmark,
//         this.addressType,
//         this.city,
//         this.district,
//         this.name,
//         this.state,
//         this.country,
//         this.isDeliverable,
//         this.isDefault,
//         this.additionalInstructions,
//         this.createdAt,
//         this.updatedAt,
//         this.userId,
//     });

//     factory DeliveryAddress.fromJson(Map<dynamic, dynamic> json) => DeliveryAddress(
//         id: json["id"],
//         pincode: json["pincode"],
//         phoneNumber: json["phoneNumber"],
//         alternatePhoneNumber: json["alternatePhoneNumber"],
//         addressLine: json["addressLine"],
//         landmark: json["landmark"],
//         addressType: json["addressType"],
//         city: json["city"],
//         district: json["district"],
//         name: json["name"],
//         state: json["state"],
//         country: json["country"],
//         isDeliverable: json["isDeliverable"],
//         isDefault: json["isDefault"],
//         additionalInstructions: json["additionalInstructions"],
//         createdAt: DateTime.parse(json["createdAt"]),
//         updatedAt: DateTime.parse(json["updatedAt"]),
//         userId: json["userId"],
//     );

//     Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "pincode": pincode,
//         "phoneNumber": phoneNumber,
//         "alternatePhoneNumber": alternatePhoneNumber,
//         "addressLine": addressLine,
//         "landmark": landmark,
//         "addressType": addressType,
//         "city": city,
//         "district": district,
//         "name": name,
//         "state": state,
//         "country": country,
//         "isDeliverable": isDeliverable,
//         "isDefault": isDefault,
//         "additionalInstructions": additionalInstructions,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "userId": userId,
//     };
// }

// class OrderItem {
//     dynamic id;
//     dynamic orderId;
//     dynamic productId;
//     dynamic storeId;
//     dynamic productName;
//     dynamic productImage;
//     dynamic productVariant;
//     dynamic quantity;
//     dynamic price;
//     dynamic originalPrice;
//     dynamic discountAmount;
//     DateTime? createdAt;
//     DateTime? updatedAt;
//     Product? product;

//     OrderItem({
//         this.id,
//         this.orderId,
//         this.productId,
//         this.storeId,
//         this.productName,
//         this.productImage,
//         this.productVariant,
//         this.quantity,
//         this.price,
//         this.originalPrice,
//         this.discountAmount,
//         this.createdAt,
//         this.updatedAt,
//         this.product,
//     });

//     factory OrderItem.fromJson(Map<dynamic, dynamic> json) => OrderItem(
//         id: json["id"],
//         orderId: json["orderId"],
//         productId: json["productId"],
//         storeId: json["storeId"],
//         productName: json["productName"],
//         productImage: json["productImage"],
//         productVariant: json["productVariant"],
//         quantity: json["quantity"],
//         price: json["price"],
//         originalPrice: json["originalPrice"],
//         discountAmount: json["discountAmount"],
//         createdAt: DateTime.parse(json["createdAt"]),
//         updatedAt: DateTime.parse(json["updatedAt"]),
//         product: Product.fromJson(json["product"]),
//     );

//     Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "orderId": orderId,
//         "productId": productId,
//         "storeId": storeId,
//         "productName": productName,
//         "productImage": productImage,
//         "productVariant": productVariant,
//         "quantity": quantity,
//         "price": price,
//         "originalPrice": originalPrice,
//         "discountAmount": discountAmount,
//         "createdAt": createdAt,
//         "updatedAt": updatedAt,
//         "product": product!.toJson(),
//     };
// }

// class Product {
//     dynamic id;
//     dynamic name;
//     dynamic description;

//     Product({
//         this.id,
//         this.name,
//         this.description,
//     });

//     factory Product.fromJson(Map<dynamic, dynamic> json) => Product(
//         id: json["id"],
//         name: json["name"],
//         description: json["description"],
//     );

//     Map<dynamic, dynamic> toJson() => {
//         "id": id,
//         "name": name,
//         "description": description,
//     };
// }

// class StatusHistory {
//     dynamic status;
//     dynamic comment;
//     DateTime? createdAt;

//     StatusHistory({
//         this.status,
//         this.comment,
//         this.createdAt,
//     });

//     factory StatusHistory.fromJson(Map<dynamic, dynamic> json) => StatusHistory(
//         status: json["status"],
//         comment: json["comment"],
//         createdAt: DateTime.parse(json["createdAt"]),
//     );

//     Map<dynamic, dynamic> toJson() => {
//         "status": status,
//         "comment": comment,
//         "createdAt": createdAt,
//     };
// }

// class User {
//     dynamic id;
//     dynamic email;
//     dynamic phone;
//     dynamic firstName;
//     dynamic lastName;

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

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

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

// class Meta {
//     dynamic total;
//     dynamic page;
//     dynamic limit;
//     dynamic lastPage;
//     dynamic hasNextPage;
//     dynamic hasPreviousPage;

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

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

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

// To parse this JSON data, do
//
//     final myOrder = myOrderFromJson(jsondynamic);

import 'dart:convert';

MyOrder myOrderFromJson(dynamic str) => MyOrder.fromJson(json.decode(str));

dynamic myOrderToJson(MyOrder data) => json.encode(data.toJson());

class MyOrder {
  List<Datum>? data;
  Meta? meta;

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

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

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

class Datum {
  dynamic id;
  dynamic orderNumber;
  dynamic userId;
  dynamic totalItems;
  dynamic originalSubtotal;
  dynamic discountedSubtotal;
  dynamic couponDiscount;
  dynamic subtotalAfterCouponWithoutDelivery;
  dynamic deliveryCharge;
  dynamic finalTotal;
  dynamic paymentMethod;
  dynamic paymentStatus;
  dynamic transactionId;
  dynamic orderStatus;
  dynamic deliveryAddressId;
  dynamic couponId;
  dynamic cancelReason;
  dynamic cancelledBy;
  dynamic cancelledAt;
  DateTime? createdAt;
  DateTime? updatedAt;
  User? user;
  List<OrderItem>? orderItems;
  DeliveryAddress? deliveryAddress;
  dynamic? coupon;
  List<StatusHistory>? statusHistory;
  List<Store>? stores;
  dynamic? returnRequest;

  Datum({
    this.id,
    this.orderNumber,
    this.userId,
    this.totalItems,
    this.originalSubtotal,
    this.discountedSubtotal,
    this.couponDiscount,
    this.subtotalAfterCouponWithoutDelivery,
    this.deliveryCharge,
    this.finalTotal,
    this.paymentMethod,
    this.paymentStatus,
    this.transactionId,
    this.orderStatus,
    this.deliveryAddressId,
    this.couponId,
    this.cancelReason,
    this.cancelledBy,
    this.cancelledAt,
    this.createdAt,
    this.updatedAt,
    this.user,
    this.orderItems,
    this.deliveryAddress,
    this.coupon,
    this.statusHistory,
    this.stores,
    this.returnRequest,
  });

  factory Datum.fromJson(Map<dynamic, dynamic> json) => Datum(
        id: json["id"],
        orderNumber: json["orderNumber"],
        userId: json["userId"],
        totalItems: json["totalItems"],
        originalSubtotal: json["originalSubtotal"],
        discountedSubtotal: json["discountedSubtotal"],
        couponDiscount: json["couponDiscount"],
        subtotalAfterCouponWithoutDelivery:
            json["subtotalAfterCouponWithoutDelivery"],
        deliveryCharge: json["deliveryCharge"],
        finalTotal: json["finalTotal"],
        paymentMethod: json["paymentMethod"],
        paymentStatus: json["paymentStatus"],
        transactionId: json["transactionId"],
        orderStatus: json["orderStatus"],
        deliveryAddressId: json["deliveryAddressId"],
        couponId: json["couponId"],
        cancelReason: json["cancelReason"],
        cancelledBy: json["cancelledBy"],
        cancelledAt: json["cancelledAt"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
        user: User.fromJson(json["user"]),
        orderItems: List<OrderItem>.from(
            json["orderItems"].map((x) => OrderItem.fromJson(x))),
        deliveryAddress: DeliveryAddress.fromJson(json["deliveryAddress"]),
        coupon: json["coupon"],
        statusHistory: List<StatusHistory>.from(
            json["statusHistory"].map((x) => StatusHistory.fromJson(x))),
        stores: List<Store>.from(json["stores"].map((x) => Store.fromJson(x))),
        returnRequest: json["ReturnRequest"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "orderNumber": orderNumber,
        "userId": userId,
        "totalItems": totalItems,
        "originalSubtotal": originalSubtotal,
        "discountedSubtotal": discountedSubtotal,
        "couponDiscount": couponDiscount,
        "subtotalAfterCouponWithoutDelivery":
            subtotalAfterCouponWithoutDelivery,
        "deliveryCharge": deliveryCharge,
        "finalTotal": finalTotal,
        "paymentMethod": paymentMethod,
        "paymentStatus": paymentStatus,
        "transactionId": transactionId,
        "orderStatus": orderStatus,
        "deliveryAddressId": deliveryAddressId,
        "couponId": couponId,
        "cancelReason": cancelReason,
        "cancelledBy": cancelledBy,
        "cancelledAt": cancelledAt,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "user": user!.toJson(),
        "orderItems": List<dynamic>.from(orderItems!.map((x) => x.toJson())),
        "deliveryAddress": deliveryAddress!.toJson(),
        "coupon": coupon,
        "statusHistory":
            List<dynamic>.from(statusHistory!.map((x) => x.toJson())),
        "stores": List<dynamic>.from(stores!.map((x) => x.toJson())),
        "ReturnRequest": returnRequest,
      };
}

class DeliveryAddress {
  dynamic id;
  dynamic pincode;
  dynamic phoneNumber;
  dynamic alternatePhoneNumber;
  dynamic addressLine;
  dynamic landmark;
  dynamic addressType;
  dynamic city;
  dynamic district;
  dynamic name;
  dynamic state;
  dynamic country;
  bool? isDeliverable;
  bool? isDefault;
  dynamic additionalInstructions;
  DateTime? createdAt;
  DateTime? updatedAt;

  DeliveryAddress({
    this.id,
    this.pincode,
    this.phoneNumber,
    this.alternatePhoneNumber,
    this.addressLine,
    this.landmark,
    this.addressType,
    this.city,
    this.district,
    this.name,
    this.state,
    this.country,
    this.isDeliverable,
    this.isDefault,
    this.additionalInstructions,
    this.createdAt,
    this.updatedAt,
  });

  factory DeliveryAddress.fromJson(Map<dynamic, dynamic> json) =>
      DeliveryAddress(
        id: json["id"],
        pincode: json["pincode"],
        phoneNumber: json["phoneNumber"],
        alternatePhoneNumber: json["alternatePhoneNumber"],
        addressLine: json["addressLine"],
        landmark: json["landmark"],
        addressType: json["addressType"],
        city: json["city"],
        district: json["district"],
        name: json["name"],
        state: json["state"],
        country: json["country"],
        isDeliverable: json["isDeliverable"],
        isDefault: json["isDefault"],
        additionalInstructions: json["additionalInstructions"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "pincode": pincode,
        "phoneNumber": phoneNumber,
        "alternatePhoneNumber": alternatePhoneNumber,
        "addressLine": addressLine,
        "landmark": landmark,
        "addressType": addressType,
        "city": city,
        "district": district,
        "name": name,
        "state": state,
        "country": country,
        "isDeliverable": isDeliverable,
        "isDefault": isDefault,
        "additionalInstructions": additionalInstructions,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
      };
}

class OrderItem {
  dynamic id;
  dynamic orderId;
  dynamic? productId;
  dynamic storeId;
  dynamic productName;
  dynamic productImage;
  dynamic productVariant;
  dynamic? quantity;
  dynamic orderItemStatus;
  // dynamic originalProductPrice;
  // dynamic originalProductDiscountPrice;
  // dynamic discountAmount;
  dynamic totalOrderItemPrice;
  // dynamic totalOrderDiscount;
  // dynamic status;
  // DateTime? createdAt;
  // DateTime? updatedAt;
  // Product? product;
  // Store? store;
  // List<dynamic>? orderItemStatusHistory;

  OrderItem({
    this.id,
    this.orderId,
    this.productId,
    this.storeId,
    this.productName,
    this.productImage,
    this.productVariant,
    this.quantity,
    this.orderItemStatus,
    // this.originalProductPrice,
    // this.originalProductDiscountPrice,
    // this.discountAmount,
    this.totalOrderItemPrice,
    // this.totalOrderDiscount,
    // this.status,
    // this.createdAt,
    // this.updatedAt,
    // this.product,
    // this.store,
    // this.orderItemStatusHistory,
  });

  factory OrderItem.fromJson(Map<dynamic, dynamic> json) => OrderItem(
        id: json["id"],
        orderId: json["orderId"],
        productId: json["productId"],
        storeId: json["storeId"],
        productName: json["productName"],
        productImage: json["productImage"],
        productVariant: json["productVariant"],
        quantity: json["quantity"],

orderItemStatus: json["orderItemStatus"],
        
        // originalProductPrice: json["originalProductPrice"],
        // originalProductDiscountPrice: json["originalProductDiscountPrice"],
        // discountAmount: json["discountAmount"],
        totalOrderItemPrice: json["totalOrderItemPrice"],
        // totalOrderDiscount: json["totalOrderDiscount"],
        // status: json["status"],
        // createdAt: DateTime.parse(json["createdAt"]),
        // updatedAt: DateTime.parse(json["updatedAt"]),
        // product: Product.fromJson(json["product"]),
        // store: Store.fromJson(json["store"]),
        // orderItemStatusHistory:
        //     List<dynamic>.from(json["OrderItemStatusHistory"].map((x) => x)),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "orderId": orderId,
        "productId": productId,
        "storeId": storeId,
        "productName": productName,
        "productImage": productImage,
        "productVariant": productVariant,
        "quantity": quantity,
   "orderItemStatus": orderItemStatus,


        
        // "originalProductPrice": originalProductPrice,
        // "originalProductDiscountPrice": originalProductDiscountPrice,
        // "discountAmount": discountAmount,
        "totalOrderItemPrice": totalOrderItemPrice,
        // "totalOrderDiscount": totalOrderDiscount,
        // "status": status,
        // "createdAt": createdAt,
        // "updatedAt": updatedAt,
        // "product": product!.toJson(),
        // "store": store!.toJson(),
        // "OrderItemStatusHistory":
        //     List<dynamic>.from(orderItemStatusHistory!.map((x) => x)),
      };
}

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;
  bool? isInStock;
  bool? isActive;
  dynamic disclaimer;
  dynamic customerCareDetails;
  dynamic manufacturerName;
  dynamic manufacturerAddress;
  dynamic countryOfOrigin;
  DateTime? expiryDate;
  dynamic returnsAllowedDays;
  dynamic exchangeAllowedDays;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic storeId;
  dynamic categoryId;
  dynamic productTypeId;
  dynamic timeSlotId;
  List<ProductImage>? productImages;
  Category? category;
  dynamic productType;
  dynamic timeSlot;
  List<ProductTag>? productTags;
  List<dynamic>? zones;
  List<dynamic>? cartItems;
  List<dynamic>? questions;
  List<dynamic>? productReview;
  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.productImages,
    this.category,
    this.productType,
    this.timeSlot,
    this.productTags,
    this.zones,
    this.cartItems,
    this.questions,
    this.productReview,
    this.applicableCoupons,
  });

  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"],
        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: DateTime.parse(json["expiryDate"]),
        returnsAllowedDays: json["returnsAllowedDays"],
        exchangeAllowedDays: json["exchangeAllowedDays"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
        storeId: json["storeId"],
        categoryId: json["categoryId"],
        productTypeId: json["productTypeId"],
        timeSlotId: json["timeSlotId"],
        productImages: List<ProductImage>.from(
            json["productImages"].map((x) => ProductImage.fromJson(x))),
        category: Category.fromJson(json["category"]),
        productType: json["productType"],
        timeSlot: json["timeSlot"],
        productTags: List<ProductTag>.from(
            json["productTags"].map((x) => ProductTag.fromJson(x))),
        zones: List<dynamic>.from(json["zones"].map((x) => x)),
        cartItems: List<dynamic>.from(json["cartItems"].map((x) => x)),
        questions: List<dynamic>.from(json["questions"].map((x) => x)),
        productReview: List<dynamic>.from(json["ProductReview"].map((x) => 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,
        "productImages":
            List<dynamic>.from(productImages!.map((x) => x.toJson())),
        "category": category!.toJson(),
        "productType": productType,
        "timeSlot": timeSlot,
        "productTags": List<dynamic>.from(productTags!.map((x) => x.toJson())),
        "zones": List<dynamic>.from(zones!.map((x) => x)),
        "cartItems": List<dynamic>.from(cartItems!.map((x) => x)),
        "questions": List<dynamic>.from(questions!.map((x) => x)),
        "ProductReview": List<dynamic>.from(productReview!.map((x) => x)),
        "applicableCoupons":
            List<dynamic>.from(applicableCoupons!.map((x) => x)),
      };
}

class Category {
  dynamic name;
  dynamic path;
  ParentCategory? parentCategory;

  Category({
    this.name,
    this.path,
    this.parentCategory,
  });

  factory Category.fromJson(Map<dynamic, dynamic> json) => Category(
        name: json["name"],
        path: json["path"],
        parentCategory: ParentCategory.fromJson(json["parentCategory"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "name": name,
        "path": path,
        "parentCategory": parentCategory!.toJson(),
      };
}

class ParentCategory {
  dynamic name;
  dynamic id;

  ParentCategory({
    this.name,
    this.id,
  });

  factory ParentCategory.fromJson(Map<dynamic, dynamic> json) => ParentCategory(
        name: json["name"],
        id: json["id"],
      );

  Map<dynamic, dynamic> toJson() => {
        "name": name,
        "id": id,
      };
}

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 ProductTag {
  dynamic id;
  dynamic name;
  dynamic description;
  bool? 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: json["description"],
        isActive: json["isActive"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
      );

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

class Store {
  dynamic id;
  dynamic storeName;
  dynamic storeDescription;
  dynamic officialPhoneNumber;
  dynamic storeAddress;
  dynamic gstNumber;
  dynamic gumastaNumber;
  dynamic storePicture;
  dynamic sellerLicenseNumber;
  DateTime? createdAt;
  DateTime? updatedAt;
  dynamic vendorId;
  bool? isActive;
  dynamic couponId;
  dynamic orderId;
  User? vendor;

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

  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"],
        sellerLicenseNumber: json["sellerLicenseNumber"],
        createdAt: DateTime.parse(json["createdAt"]),
        updatedAt: DateTime.parse(json["updatedAt"]),
        vendorId: json["vendorId"],
        isActive: json["isActive"],
        couponId: json["couponId"],
        orderId: json["orderId"],
        vendor: User.fromJson(json["vendor"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "storeName": storeName,
        "storeDescription": storeDescription,
        "officialPhoneNumber": officialPhoneNumber,
        "storeAddress": storeAddress,
        "gstNumber": gstNumber,
        "gumastaNumber": gumastaNumber,
        "storePicture": storePicture,
        "sellerLicenseNumber": sellerLicenseNumber,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
        "vendorId": vendorId,
        "isActive": isActive,
        "couponId": couponId,
        "orderId": orderId,
        "vendor": vendor!.toJson(),
      };
}

class OperateDates {
  dynamic id;
  bool? monday;
  bool? tuesday;
  bool? wednesday;
  bool? thursday;
  bool? friday;
  bool? saturday;
  bool? sunday;
  dynamic storeId;

  OperateDates({
    this.id,
    this.monday,
    this.tuesday,
    this.wednesday,
    this.thursday,
    this.friday,
    this.saturday,
    this.sunday,
    this.storeId,
  });

  factory OperateDates.fromJson(Map<dynamic, dynamic> json) => OperateDates(
        id: json["id"],
        monday: json["monday"],
        tuesday: json["tuesday"],
        wednesday: json["wednesday"],
        thursday: json["thursday"],
        friday: json["friday"],
        saturday: json["saturday"],
        sunday: json["sunday"],
        storeId: json["storeId"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "monday": monday,
        "tuesday": tuesday,
        "wednesday": wednesday,
        "thursday": thursday,
        "friday": friday,
        "saturday": saturday,
        "sunday": sunday,
        "storeId": storeId,
      };
}

class OperateTimes {
  dynamic id;
  dynamic startTime;
  dynamic endTime;
  dynamic storeId;

  OperateTimes({
    this.id,
    this.startTime,
    this.endTime,
    this.storeId,
  });

  factory OperateTimes.fromJson(Map<dynamic, dynamic> json) => OperateTimes(
        id: json["id"],
        startTime: json["startTime"],
        endTime: json["endTime"],
        storeId: json["storeId"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "startTime": startTime,
        "endTime": endTime,
        "storeId": storeId,
      };
}

class User {
  dynamic id;
  dynamic email;
  dynamic firstName;
  dynamic lastName;
  dynamic phone;
  dynamic role;
  bool? isPhoneVerified;
  dynamic vendorType;
  dynamic businessId;
  bool? isActive;

  User({
    this.id,
    this.email,
    this.firstName,
    this.lastName,
    this.phone,
    this.role,
    this.isPhoneVerified,
    this.vendorType,
    this.businessId,
    this.isActive,
  });

  factory User.fromJson(Map<dynamic, dynamic> json) => User(
        id: json["id"],
        email: json["email"],
        firstName: json["firstName"],
        lastName: json["lastName"],
        phone: json["phone"],
        role: json["role"],
        isPhoneVerified: json["isPhoneVerified"],
        vendorType: json["vendorType"],
        businessId: json["businessId"],
        isActive: json["isActive"],
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "email": email,
        "firstName": firstName,
        "lastName": lastName,
        "phone": phone,
        "role": role,
        "isPhoneVerified": isPhoneVerified,
        "vendorType": vendorType,
        "businessId": businessId,
        "isActive": isActive,
      };
}

class StatusHistory {
  dynamic id;
  dynamic orderId;
  dynamic status;
  dynamic comment;
  dynamic updatedBy;
  DateTime? createdAt;

  StatusHistory({
    this.id,
    this.orderId,
    this.status,
    this.comment,
    this.updatedBy,
    this.createdAt,
  });

  factory StatusHistory.fromJson(Map<dynamic, dynamic> json) => StatusHistory(
        id: json["id"],
        orderId: json["orderId"],
        status: json["status"],
        comment: json["comment"],
        updatedBy: json["updatedBy"],
        createdAt: DateTime.parse(json["createdAt"]),
      );

  Map<dynamic, dynamic> toJson() => {
        "id": id,
        "orderId": orderId,
        "status": status,
        "comment": comment,
        "updatedBy": updatedBy,
        "createdAt": createdAt,
      };
}

class Meta {
  int? total;
  int? page;
  int? limit;
  int? lastPage;
  bool? hasNextPage;
  bool? hasPreviousPage;

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

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

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

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;
  }
}
