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

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

part 'set_delivery_order_response.g.dart';

/// SetDeliveryOrderResponse
///
/// Properties:
/// * [order] 
/// * [tourId] 
@BuiltValue()
abstract class SetDeliveryOrderResponse implements Built<SetDeliveryOrderResponse, SetDeliveryOrderResponseBuilder> {
  @BuiltValueField(wireName: r'order')
  BuiltList<DeliveryOrderEntry> get order;

  @BuiltValueField(wireName: r'tourId')
  String get tourId;

  SetDeliveryOrderResponse._();

  factory SetDeliveryOrderResponse([void updates(SetDeliveryOrderResponseBuilder b)]) = _$SetDeliveryOrderResponse;

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

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

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

  @override
  final String wireName = r'SetDeliveryOrderResponse';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    SetDeliveryOrderResponse object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'order';
    yield serializers.serialize(
      object.order,
      specifiedType: const FullType(BuiltList, [FullType(DeliveryOrderEntry)]),
    );
    yield r'tourId';
    yield serializers.serialize(
      object.tourId,
      specifiedType: const FullType(String),
    );
  }

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

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

