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

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

part 'car_response.g.dart';

/// CarResponse
///
/// Properties:
/// * [car] 
@BuiltValue()
abstract class CarResponse implements Built<CarResponse, CarResponseBuilder> {
  @BuiltValueField(wireName: r'car')
  Car get car;

  CarResponse._();

  factory CarResponse([void updates(CarResponseBuilder b)]) = _$CarResponse;

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

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

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

  @override
  final String wireName = r'CarResponse';

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

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

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

