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

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

part 'tour_summary.g.dart';

/// TourSummary
///
/// Properties:
/// * [deliveryCount] 
/// * [tourDate] 
/// * [tourId] 
@BuiltValue()
abstract class TourSummary implements Built<TourSummary, TourSummaryBuilder> {
  @BuiltValueField(wireName: r'deliveryCount')
  int get deliveryCount;

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

  @BuiltValueField(wireName: r'tourId')
  String get tourId;

  TourSummary._();

  factory TourSummary([void updates(TourSummaryBuilder b)]) = _$TourSummary;

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

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

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

  @override
  final String wireName = r'TourSummary';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    TourSummary object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'deliveryCount';
    yield serializers.serialize(
      object.deliveryCount,
      specifiedType: const FullType(int),
    );
    yield r'tourDate';
    yield serializers.serialize(
      object.tourDate,
      specifiedType: const FullType(Date),
    );
    yield r'tourId';
    yield serializers.serialize(
      object.tourId,
      specifiedType: const FullType(String),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    TourSummary 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 TourSummaryBuilder 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'deliveryCount':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(int),
          ) as int;
          result.deliveryCount = valueDes;
          break;
        case r'tourDate':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(Date),
          ) as Date;
          result.tourDate = valueDes;
          break;
        case r'tourId':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(String),
          ) as String;
          result.tourId = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

