//
// 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 'assign_car_request.g.dart';

/// Setzt das `assigned_car_id` einer Lieferung. `None` (`carId: null`) entfernt die Zuordnung.
///
/// Properties:
/// * [carId] 
@BuiltValue()
abstract class AssignCarRequest implements Built<AssignCarRequest, AssignCarRequestBuilder> {
  @BuiltValueField(wireName: r'carId')
  String? get carId;

  AssignCarRequest._();

  factory AssignCarRequest([void updates(AssignCarRequestBuilder b)]) = _$AssignCarRequest;

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

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

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

  @override
  final String wireName = r'AssignCarRequest';

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

  @override
  Object serialize(
    Serializers serializers,
    AssignCarRequest 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 AssignCarRequestBuilder 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'carId':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType.nullable(String),
          ) as String?;
          if (valueDes == null) continue;
          result.carId = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

