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

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

part 'payment_methods_list.g.dart';

/// PaymentMethodsList
///
/// Properties:
/// * [methods] 
@BuiltValue()
abstract class PaymentMethodsList implements Built<PaymentMethodsList, PaymentMethodsListBuilder> {
  @BuiltValueField(wireName: r'methods')
  BuiltList<PaymentMethod> get methods;

  PaymentMethodsList._();

  factory PaymentMethodsList([void updates(PaymentMethodsListBuilder b)]) = _$PaymentMethodsList;

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

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

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

  @override
  final String wireName = r'PaymentMethodsList';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    PaymentMethodsList object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'methods';
    yield serializers.serialize(
      object.methods,
      specifiedType: const FullType(BuiltList, [FullType(PaymentMethod)]),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    PaymentMethodsList 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 PaymentMethodsListBuilder 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'methods':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(BuiltList, [FullType(PaymentMethod)]),
          ) as BuiltList<PaymentMethod>;
          result.methods.replace(valueDes);
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

