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

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

part 'delivery_service_response.g.dart';

/// DeliveryServiceResponse
///
/// Properties:
/// * [value] 
@BuiltValue()
abstract class DeliveryServiceResponse implements Built<DeliveryServiceResponse, DeliveryServiceResponseBuilder> {
  @BuiltValueField(wireName: r'value')
  DeliveryServiceValue get value;

  DeliveryServiceResponse._();

  factory DeliveryServiceResponse([void updates(DeliveryServiceResponseBuilder b)]) = _$DeliveryServiceResponse;

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

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

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

  @override
  final String wireName = r'DeliveryServiceResponse';

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

  @override
  Object serialize(
    Serializers serializers,
    DeliveryServiceResponse 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 DeliveryServiceResponseBuilder 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'value':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(DeliveryServiceValue),
          ) as DeliveryServiceValue;
          result.value.replace(valueDes);
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

