// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'order_model.dart';

// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************

class OrderModelAdapter extends TypeAdapter<OrderModel> {
  @override
  final typeId = 6;

  @override
  OrderModel read(BinaryReader reader) {
    final numOfFields = reader.readByte();
    final fields = <int, dynamic>{
      for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
    };
    return OrderModel(
      orderId: fields[0] as String,
      orderNumber: fields[1] as String,
      userId: fields[2] as String,
      status: fields[3] as OrderStatus,
      totalAmount: (fields[4] as num).toDouble(),
      discountAmount: (fields[5] as num).toDouble(),
      taxAmount: (fields[6] as num).toDouble(),
      shippingFee: (fields[7] as num).toDouble(),
      finalAmount: (fields[8] as num).toDouble(),
      shippingAddress: fields[9] as String?,
      billingAddress: fields[10] as String?,
      expectedDeliveryDate: fields[11] as DateTime?,
      actualDeliveryDate: fields[12] as DateTime?,
      notes: fields[13] as String?,
      cancellationReason: fields[14] as String?,
      erpnextSalesOrder: fields[15] as String?,
      createdAt: fields[16] as DateTime,
      updatedAt: fields[17] as DateTime?,
    );
  }

  @override
  void write(BinaryWriter writer, OrderModel obj) {
    writer
      ..writeByte(18)
      ..writeByte(0)
      ..write(obj.orderId)
      ..writeByte(1)
      ..write(obj.orderNumber)
      ..writeByte(2)
      ..write(obj.userId)
      ..writeByte(3)
      ..write(obj.status)
      ..writeByte(4)
      ..write(obj.totalAmount)
      ..writeByte(5)
      ..write(obj.discountAmount)
      ..writeByte(6)
      ..write(obj.taxAmount)
      ..writeByte(7)
      ..write(obj.shippingFee)
      ..writeByte(8)
      ..write(obj.finalAmount)
      ..writeByte(9)
      ..write(obj.shippingAddress)
      ..writeByte(10)
      ..write(obj.billingAddress)
      ..writeByte(11)
      ..write(obj.expectedDeliveryDate)
      ..writeByte(12)
      ..write(obj.actualDeliveryDate)
      ..writeByte(13)
      ..write(obj.notes)
      ..writeByte(14)
      ..write(obj.cancellationReason)
      ..writeByte(15)
      ..write(obj.erpnextSalesOrder)
      ..writeByte(16)
      ..write(obj.createdAt)
      ..writeByte(17)
      ..write(obj.updatedAt);
  }

  @override
  int get hashCode => typeId.hashCode;

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is OrderModelAdapter &&
          runtimeType == other.runtimeType &&
          typeId == other.typeId;
}
