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

// ignore_for_file: unused_element
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'delivered_belegnummern_response.g.dart';

/// DeliveredBelegnummernResponse
///
/// Properties:
/// * [belegnummern] - Belegnummern aller **ausgelieferten** (abgeschlossenen) Lieferungen, deren Liefermail noch **nicht versendet** wurde, aufsteigend nach Abschluss-Zeitpunkt.
/// * [count] - Anzahl der offenen (noch nicht versendeten) Belege.
/// * [day] - Tag, nach dem gefiltert wurde (ISO `YYYY-MM-DD`), oder `\"all\"` wenn kein `day` angegeben war.
@BuiltValue()
abstract class DeliveredBelegnummernResponse implements Built<DeliveredBelegnummernResponse, DeliveredBelegnummernResponseBuilder> {
  /// Belegnummern aller **ausgelieferten** (abgeschlossenen) Lieferungen, deren Liefermail noch **nicht versendet** wurde, aufsteigend nach Abschluss-Zeitpunkt.
  @BuiltValueField(wireName: r'belegnummern')
  BuiltList<String> get belegnummern;

  /// Anzahl der offenen (noch nicht versendeten) Belege.
  @BuiltValueField(wireName: r'count')
  int get count;

  /// Tag, nach dem gefiltert wurde (ISO `YYYY-MM-DD`), oder `\"all\"` wenn kein `day` angegeben war.
  @BuiltValueField(wireName: r'day')
  String get day;

  DeliveredBelegnummernResponse._();

  factory DeliveredBelegnummernResponse([void updates(DeliveredBelegnummernResponseBuilder b)]) = _$DeliveredBelegnummernResponse;

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

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

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

  @override
  final String wireName = r'DeliveredBelegnummernResponse';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    DeliveredBelegnummernResponse object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'belegnummern';
    yield serializers.serialize(
      object.belegnummern,
      specifiedType: const FullType(BuiltList, [FullType(String)]),
    );
    yield r'count';
    yield serializers.serialize(
      object.count,
      specifiedType: const FullType(int),
    );
    yield r'day';
    yield serializers.serialize(
      object.day,
      specifiedType: const FullType(String),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    DeliveredBelegnummernResponse 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 DeliveredBelegnummernResponseBuilder 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'belegnummern':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(BuiltList, [FullType(String)]),
          ) as BuiltList<String>;
          result.belegnummern.replace(valueDes);
          break;
        case r'count':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(int),
          ) as int;
          result.count = valueDes;
          break;
        case r'day':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(String),
          ) as String;
          result.day = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

