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

// ignore_for_file: unused_element
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'warehouse.g.dart';

/// Lager. ERP-Mirror; `code` ist die ERP-Lager-Nr (z. B. `\"0\"` für das Standardlager). Das `is_standard`-Flag ist der schnelle Filter für die Beladen-Logik („nur Standardlager-Artikel zählen für Fertig\").
///
/// Properties:
/// * [code] 
/// * [id] 
/// * [isStandard] 
/// * [name] 
@BuiltValue()
abstract class Warehouse implements Built<Warehouse, WarehouseBuilder> {
  @BuiltValueField(wireName: r'code')
  String get code;

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

  @BuiltValueField(wireName: r'isStandard')
  bool get isStandard;

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

  Warehouse._();

  factory Warehouse([void updates(WarehouseBuilder b)]) = _$Warehouse;

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

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

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

  @override
  final String wireName = r'Warehouse';

  Iterable<Object?> _serializeProperties(
    Serializers serializers,
    Warehouse object, {
    FullType specifiedType = FullType.unspecified,
  }) sync* {
    yield r'code';
    yield serializers.serialize(
      object.code,
      specifiedType: const FullType(String),
    );
    yield r'id';
    yield serializers.serialize(
      object.id,
      specifiedType: const FullType(String),
    );
    yield r'isStandard';
    yield serializers.serialize(
      object.isStandard,
      specifiedType: const FullType(bool),
    );
    yield r'name';
    yield serializers.serialize(
      object.name,
      specifiedType: const FullType(String),
    );
  }

  @override
  Object serialize(
    Serializers serializers,
    Warehouse 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 WarehouseBuilder 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'code':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(String),
          ) as String;
          result.code = valueDes;
          break;
        case r'id':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(String),
          ) as String;
          result.id = valueDes;
          break;
        case r'isStandard':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(bool),
          ) as bool;
          result.isStandard = valueDes;
          break;
        case r'name':
          final valueDes = serializers.deserialize(
            value,
            specifiedType: const FullType(String),
          ) as String;
          result.name = valueDes;
          break;
        default:
          unhandled.add(key);
          unhandled.add(value);
          break;
      }
    }
  }

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

