// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'product_response_model.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

ProductDetailResponse _$ProductDetailResponseFromJson(
  Map<String, dynamic> json,
) => ProductDetailResponse(
  reviewDisplayType: json['review_display_type'] as String,
  reviewDisplayPolicy: json['review_display_policy'] as String,
  productInfo: ProductInfoResponse.fromJson(
    json['product_info'] as Map<String, dynamic>,
  ),
);

Map<String, dynamic> _$ProductDetailResponseToJson(
  ProductDetailResponse instance,
) => <String, dynamic>{
  'review_display_type': instance.reviewDisplayType,
  'review_display_policy': instance.reviewDisplayPolicy,
  'product_info': instance.productInfo,
};

ProductInfoResponse _$ProductInfoResponseFromJson(Map<String, dynamic> json) =>
    ProductInfoResponse(
      id: json['id'] as String,
      serverImageUrls: (json['server_image_url'] as List<dynamic>)
          .map((e) => e as String)
          .toList(),
      name: json['name'] as String,
      hasVariant: json['has_variant'] as bool,
      unit: json['unit'] as String,
      variants: (json['variants'] as List<dynamic>)
          .map(
            (e) => ProductVariantResponse.fromJson(e as Map<String, dynamic>),
          )
          .toList(),
      description: json['description'] as String?,
    );

Map<String, dynamic> _$ProductInfoResponseToJson(
  ProductInfoResponse instance,
) => <String, dynamic>{
  'id': instance.id,
  'server_image_url': instance.serverImageUrls,
  'name': instance.name,
  'has_variant': instance.hasVariant,
  'unit': instance.unit,
  'variants': instance.variants,
  'description': instance.description,
};

ProductVariantResponse _$ProductVariantResponseFromJson(
  Map<String, dynamic> json,
) => ProductVariantResponse(
  id: json['id'] as String,
  serverImageUrl: json['server_image_url'] as String?,
  name: json['name'] as String,
  isProductVariant: json['is_product_variant'] as bool,
  sellingPrice: (json['selling_price'] as num).toDouble(),
  stockType: json['stock_type'] as String,
  stock: toDouble(json['stock']),
  totalSold: toDouble(json['total_sold']),
  reviews: (json['reviews'] as List<dynamic>)
      .map((e) => ProductReviewResponse.fromJson(e as Map<String, dynamic>))
      .toList(),
);

Map<String, dynamic> _$ProductVariantResponseToJson(
  ProductVariantResponse instance,
) => <String, dynamic>{
  'id': instance.id,
  'server_image_url': instance.serverImageUrl,
  'name': instance.name,
  'is_product_variant': instance.isProductVariant,
  'selling_price': instance.sellingPrice,
  'stock_type': instance.stockType,
  'stock': instance.stock,
  'total_sold': instance.totalSold,
  'reviews': instance.reviews,
};

ProductReviewResponse _$ProductReviewResponseFromJson(
  Map<String, dynamic> json,
) => ProductReviewResponse(
  id: json['id'] as String,
  customerName: json['customer_name'] as String,
  ratingCount: (json['rating_count'] as num).toInt(),
  comment: json['comment'] as String?,
);

Map<String, dynamic> _$ProductReviewResponseToJson(
  ProductReviewResponse instance,
) => <String, dynamic>{
  'id': instance.id,
  'customer_name': instance.customerName,
  'rating_count': instance.ratingCount,
  'comment': instance.comment,
};
