// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'inventory_summary_response.dart';

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

InventorySummaryResponse _$InventorySummaryResponseFromJson(
  Map<String, dynamic> json,
) => InventorySummaryResponse(
  items:
      (json['items'] as List<dynamic>?)
          ?.map(
            (e) => InventorySummaryItemDto.fromJson(e as Map<String, dynamic>),
          )
          .toList() ??
      [],
  page: (json['page'] as num?)?.toInt() ?? 1,
  pageSize: (json['page_size'] as num?)?.toInt() ?? 0,
  total: (json['total'] as num?)?.toInt() ?? 0,
  lastRefreshedAt: json['last_refreshed_at'] == null
      ? null
      : DateTime.parse(json['last_refreshed_at'] as String),
);

Map<String, dynamic> _$InventorySummaryResponseToJson(
  InventorySummaryResponse instance,
) => <String, dynamic>{
  'items': instance.items.map((e) => e.toJson()).toList(),
  'page': instance.page,
  'page_size': instance.pageSize,
  'total': instance.total,
  'last_refreshed_at': instance.lastRefreshedAt?.toIso8601String(),
};

InventorySummaryItemDto _$InventorySummaryItemDtoFromJson(
  Map<String, dynamic> json,
) => InventorySummaryItemDto(
  product: InventoryProductDto.fromJson(
    json['product'] as Map<String, dynamic>,
  ),
  totalQuantity: _parseQuantity(json['total_quantity']),
  warehouseBalances:
      (json['warehouse_balances'] as List<dynamic>?)
          ?.map(
            (e) => InventoryWarehouseBalanceDto.fromJson(
              e as Map<String, dynamic>,
            ),
          )
          .toList() ??
      [],
  recentEvent: json['recent_event'] == null
      ? null
      : InventoryEventDto.fromJson(
          json['recent_event'] as Map<String, dynamic>,
        ),
  updatedAt: json['updated_at'] == null
      ? null
      : DateTime.parse(json['updated_at'] as String),
  lastRefreshedAt: json['last_refreshed_at'] == null
      ? null
      : DateTime.parse(json['last_refreshed_at'] as String),
);

Map<String, dynamic> _$InventorySummaryItemDtoToJson(
  InventorySummaryItemDto instance,
) => <String, dynamic>{
  'product': instance.product.toJson(),
  'total_quantity': instance.totalQuantity,
  'warehouse_balances': instance.warehouseBalances
      .map((e) => e.toJson())
      .toList(),
  'recent_event': instance.recentEvent?.toJson(),
  'updated_at': instance.updatedAt?.toIso8601String(),
  'last_refreshed_at': instance.lastRefreshedAt?.toIso8601String(),
};
