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

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

part 'service_response.g.dart';

/// ServiceResponse
///
/// Properties:
/// * [service] 
@BuiltValue()
abstract class ServiceResponse implements Built<ServiceResponse, ServiceResponseBuilder> {
  @BuiltValueField(wireName: r'service')
  Service get service;

  ServiceResponse._();

  factory ServiceResponse([void updates(ServiceResponseBuilder b)]) = _$ServiceResponse;

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

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

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

  @override
  final String wireName = r'ServiceResponse';

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

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

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

