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

// ignore_for_file: unused_element
import 'package:built_collection/built_collection.dart';
import 'package:holzleitner_api/src/model/date.dart';
import 'package:holzleitner_api/src/model/sync_delivery.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'sync_tour_request.g.dart';

/// SyncTourRequest
///
/// Properties:
/// * [deliveries] 
/// * [driverPersonalnummer] 
/// * [tourDate] 
@BuiltValue()
abstract class SyncTourRequest implements Built<SyncTourRequest, SyncTourRequestBuilder> {
  @BuiltValueField(wireName: r'deliveries')
  BuiltList<SyncDelivery> get deliveries;

  @BuiltValueField(wireName: r'driverPersonalnummer')
  int get driverPersonalnummer;

  @BuiltValueField(wireName: r'tourDate')
  Date get tourDate;

  SyncTourRequest._();

  factory SyncTourRequest([void updates(SyncTourRequestBuilder b)]) = _$SyncTourRequest;

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

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

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

  @override
  final String wireName = r'SyncTourRequest';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    SyncTourRequest object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'deliveries';
    yield serializers.serialize(
      object.deliveries,
      specifiedType: const FullType(BuiltList, [FullType(SyncDelivery)]),
    );
    yield r'driverPersonalnummer';
    yield serializers.serialize(
      object.driverPersonalnummer,
      specifiedType: const FullType(int),
    );
    yield r'tourDate';
    yield serializers.serialize(
      object.tourDate,
      specifiedType: const FullType(Date),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    SyncTourRequest 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 SyncTourRequestBuilder 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'deliveries':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(BuiltList, [FullType(SyncDelivery)]),
          ) as BuiltList<SyncDelivery>;
          result.deliveries.replace(valueDes);
          break;
        case r'driverPersonalnummer':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(int),
          ) as int;
          result.driverPersonalnummer = valueDes;
          break;
        case r'tourDate':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(Date),
          ) as Date;
          result.tourDate = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

