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

// ignore_for_file: unused_element
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'set_delivery_service_request.g.dart';

/// Setzt den Wert eines Service für eine Lieferung (Upsert). Es muss genau das zum `ServiceKind` passende Feld gesetzt sein (Use Case prüft das).
///
/// Properties:
/// * [authorCarId] 
/// * [boolValue] 
/// * [numericValue] 
@BuiltValue()
abstract class SetDeliveryServiceRequest implements Built<SetDeliveryServiceRequest, SetDeliveryServiceRequestBuilder> {
  @BuiltValueField(wireName: r'authorCarId')
  String? get authorCarId;

  @BuiltValueField(wireName: r'boolValue')
  bool? get boolValue;

  @BuiltValueField(wireName: r'numericValue')
  int? get numericValue;

  SetDeliveryServiceRequest._();

  factory SetDeliveryServiceRequest([void updates(SetDeliveryServiceRequestBuilder b)]) = _$SetDeliveryServiceRequest;

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

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

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

  @override
  final String wireName = r'SetDeliveryServiceRequest';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    SetDeliveryServiceRequest object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    if (object.authorCarId != null) {
      yield r'authorCarId';
      yield serializers.serialize(
        object.authorCarId,
        specifiedType: const FullType.nullable(String),
      );
    }
    if (object.boolValue != null) {
      yield r'boolValue';
      yield serializers.serialize(
        object.boolValue,
        specifiedType: const FullType.nullable(bool),
      );
    }
    if (object.numericValue != null) {
      yield r'numericValue';
      yield serializers.serialize(
        object.numericValue,
        specifiedType: const FullType.nullable(int),
      );
    }
  }

  @override
  Object serialize(
    Serializers serializers,
    SetDeliveryServiceRequest 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 SetDeliveryServiceRequestBuilder 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'authorCarId':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType.nullable(String),
          ) as String?;
          if (valueDes == null) continue;
          result.authorCarId = valueDes;
          break;
        case r'boolValue':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType.nullable(bool),
          ) as bool?;
          if (valueDes == null) continue;
          result.boolValue = valueDes;
          break;
        case r'numericValue':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType.nullable(int),
          ) as int?;
          if (valueDes == null) continue;
          result.numericValue = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

