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

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

part 'apply_scans_response.g.dart';

/// ApplyScansResponse
///
/// Properties:
/// * [results] 
@BuiltValue()
abstract class ApplyScansResponse implements Built<ApplyScansResponse, ApplyScansResponseBuilder> {
  @BuiltValueField(wireName: r'results')
  BuiltList<ScanResult> get results;

  ApplyScansResponse._();

  factory ApplyScansResponse([void updates(ApplyScansResponseBuilder b)]) = _$ApplyScansResponse;

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

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

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

  @override
  final String wireName = r'ApplyScansResponse';

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

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

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

