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

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

part 'services_list.g.dart';

/// ServicesList
///
/// Properties:
/// * [services] 
@BuiltValue()
abstract class ServicesList implements Built<ServicesList, ServicesListBuilder> {
  @BuiltValueField(wireName: r'services')
  BuiltList<Service> get services;

  ServicesList._();

  factory ServicesList([void updates(ServicesListBuilder b)]) = _$ServicesList;

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

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

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

  @override
  final String wireName = r'ServicesList';

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

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

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

