// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'inventory_common_dtos.dart';

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

InventoryVendorDto _$InventoryVendorDtoFromJson(Map<String, dynamic> json) =>
    InventoryVendorDto(
      id: (json['id'] as num?)?.toInt(),
      vendorName: json['vendor_name'] as String?,
    );

Map<String, dynamic> _$InventoryVendorDtoToJson(InventoryVendorDto instance) =>
    <String, dynamic>{'id': instance.id, 'vendor_name': instance.vendorName};

InventoryProductDto _$InventoryProductDtoFromJson(Map<String, dynamic> json) =>
    InventoryProductDto(
      id: (json['id'] as num).toInt(),
      productCode: json['product_code'] as String?,
      productName: json['product_name'] as String?,
      vendor: json['vendor'] == null
          ? null
          : InventoryVendorDto.fromJson(json['vendor'] as Map<String, dynamic>),
    );

Map<String, dynamic> _$InventoryProductDtoToJson(
  InventoryProductDto instance,
) => <String, dynamic>{
  'id': instance.id,
  'product_code': instance.productCode,
  'product_name': instance.productName,
  'vendor': instance.vendor?.toJson(),
};

InventoryWarehouseDto _$InventoryWarehouseDtoFromJson(
  Map<String, dynamic> json,
) => InventoryWarehouseDto(
  id: (json['id'] as num).toInt(),
  warehouseCode: json['warehouse_code'] as String?,
  warehouseName: json['warehouse_name'] as String?,
);

Map<String, dynamic> _$InventoryWarehouseDtoToJson(
  InventoryWarehouseDto instance,
) => <String, dynamic>{
  'id': instance.id,
  'warehouse_code': instance.warehouseCode,
  'warehouse_name': instance.warehouseName,
};

InventoryWarehouseBalanceDto _$InventoryWarehouseBalanceDtoFromJson(
  Map<String, dynamic> json,
) => InventoryWarehouseBalanceDto(
  warehouse: InventoryWarehouseDto.fromJson(
    json['warehouse'] as Map<String, dynamic>,
  ),
  quantity: _parseQuantity(json['quantity']),
);

Map<String, dynamic> _$InventoryWarehouseBalanceDtoToJson(
  InventoryWarehouseBalanceDto instance,
) => <String, dynamic>{
  'warehouse': instance.warehouse.toJson(),
  'quantity': instance.quantity,
};

InventoryCounterpartyDto _$InventoryCounterpartyDtoFromJson(
  Map<String, dynamic> json,
) => InventoryCounterpartyDto(
  type: json['type'] as String?,
  name: json['name'] as String?,
);

Map<String, dynamic> _$InventoryCounterpartyDtoToJson(
  InventoryCounterpartyDto instance,
) => <String, dynamic>{'type': instance.type, 'name': instance.name};

InventoryTransactionRefDto _$InventoryTransactionRefDtoFromJson(
  Map<String, dynamic> json,
) => InventoryTransactionRefDto(
  id: (json['id'] as num).toInt(),
  transactionNo: json['transaction_no'] as String?,
);

Map<String, dynamic> _$InventoryTransactionRefDtoToJson(
  InventoryTransactionRefDto instance,
) => <String, dynamic>{
  'id': instance.id,
  'transaction_no': instance.transactionNo,
};

InventoryEventLineRefDto _$InventoryEventLineRefDtoFromJson(
  Map<String, dynamic> json,
) => InventoryEventLineRefDto(
  id: (json['id'] as num).toInt(),
  lineNo: (json['line_no'] as num?)?.toInt(),
  quantity: _parseNullableQuantity(json['quantity']),
);

Map<String, dynamic> _$InventoryEventLineRefDtoToJson(
  InventoryEventLineRefDto instance,
) => <String, dynamic>{
  'id': instance.id,
  'line_no': instance.lineNo,
  'quantity': instance.quantity,
};

InventoryEventDto _$InventoryEventDtoFromJson(Map<String, dynamic> json) =>
    InventoryEventDto(
      eventId: (json['event_id'] as num).toInt(),
      eventKind: json['event_kind'] as String,
      eventLabel: json['event_label'] as String,
      deltaQuantity: _parseQuantity(json['delta_quantity']),
      occurredAt: DateTime.parse(json['occurred_at'] as String),
      counterparty: json['counterparty'] == null
          ? null
          : InventoryCounterpartyDto.fromJson(
              json['counterparty'] as Map<String, dynamic>,
            ),
      warehouse: json['warehouse'] == null
          ? null
          : InventoryWarehouseDto.fromJson(
              json['warehouse'] as Map<String, dynamic>,
            ),
      transaction: json['transaction'] == null
          ? null
          : InventoryTransactionRefDto.fromJson(
              json['transaction'] as Map<String, dynamic>,
            ),
      line: json['line'] == null
          ? null
          : InventoryEventLineRefDto.fromJson(
              json['line'] as Map<String, dynamic>,
            ),
    );

Map<String, dynamic> _$InventoryEventDtoToJson(InventoryEventDto instance) =>
    <String, dynamic>{
      'event_id': instance.eventId,
      'event_kind': instance.eventKind,
      'event_label': instance.eventLabel,
      'delta_quantity': instance.deltaQuantity,
      'occurred_at': instance.occurredAt.toIso8601String(),
      'counterparty': instance.counterparty?.toJson(),
      'warehouse': instance.warehouse?.toJson(),
      'transaction': instance.transaction?.toJson(),
      'line': instance.line?.toJson(),
    };
