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

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

part 'delivery_note_response.g.dart';

/// DeliveryNoteResponse
///
/// Properties:
/// * [note] 
@BuiltValue()
abstract class DeliveryNoteResponse implements Built<DeliveryNoteResponse, DeliveryNoteResponseBuilder> {
  @BuiltValueField(wireName: r'note')
  DeliveryNote get note;

  DeliveryNoteResponse._();

  factory DeliveryNoteResponse([void updates(DeliveryNoteResponseBuilder b)]) = _$DeliveryNoteResponse;

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

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

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

  @override
  final String wireName = r'DeliveryNoteResponse';

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

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

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

