//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//

// ignore_for_file: unused_element
import 'package:holzleitner_api/src/model/delivery.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'delivery_response.g.dart';

/// DeliveryResponse
///
/// Properties:
/// * [delivery] 
@BuiltValue()
abstract class DeliveryResponse implements Built<DeliveryResponse, DeliveryResponseBuilder> {
  @BuiltValueField(wireName: r'delivery')
  Delivery get delivery;

  DeliveryResponse._();

  factory DeliveryResponse([void updates(DeliveryResponseBuilder b)]) = _$DeliveryResponse;

  @BuiltValueHook(initializeBuilder: true)
  static void _defaults(DeliveryResponseBuilder b) => b;

  @BuiltValueSerializer(custom: true)
  static Serializer<DeliveryResponse> get serializer => _$DeliveryResponseSerializer();
}

class _$DeliveryResponseSerializer implements PrimitiveSerializer<DeliveryResponse> {
  @override
  final Iterable<Type> types = const [DeliveryResponse, _$DeliveryResponse];

  @override
  final String wireName = r'DeliveryResponse';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    DeliveryResponse object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'delivery';
    yield serializers.serialize(
      object.delivery,
      specifiedType: const FullType(Delivery),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    DeliveryResponse object, {
    FullType specifiedType = FullType.unspecified,
  }) {
    return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
  }

  void _deserializeProperties(
    Serializers serializers,
    Object serialized, {
    FullType specifiedType = FullType.unspecified,
    required List<Object?> serializedList,
    required DeliveryResponseBuilder result,
    required List<Object?> unhandled,
  }) {
    for (var i = 0; i < serializedList.length; i += 2) {
      final key = serializedList[i] as String;
      final value = serializedList[i + 1];
      switch (key) {
        case r'delivery':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(Delivery),
          ) as Delivery;
          result.delivery = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

  @override
  DeliveryResponse deserialize(
    Serializers serializers,
    Object serialized, {
    FullType specifiedType = FullType.unspecified,
  }) {
    final result = DeliveryResponseBuilder();
    final serializedList = (serialized as Iterable<Object?>).toList();
    final unhandled = <Object?>[];
    _deserializeProperties(
      serializers,
      serialized,
      specifiedType: specifiedType,
      serializedList: serializedList,
      unhandled: unhandled,
      result: result,
    );
    return result.build();
  }
}

