// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'invoice_model.dart';

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

class InvoiceModelAdapter extends TypeAdapter<InvoiceModel> {
  @override
  final typeId = 8;

  @override
  InvoiceModel read(BinaryReader reader) {
    final numOfFields = reader.readByte();
    final fields = <int, dynamic>{
      for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
    };
    return InvoiceModel(
      invoiceId: fields[0] as String,
      invoiceNumber: fields[1] as String,
      userId: fields[2] as String,
      orderId: fields[3] as String?,
      invoiceType: fields[4] as InvoiceType,
      issueDate: fields[5] as DateTime,
      dueDate: fields[6] as DateTime,
      currency: fields[7] as String,
      subtotalAmount: (fields[8] as num).toDouble(),
      taxAmount: (fields[9] as num).toDouble(),
      discountAmount: (fields[10] as num).toDouble(),
      shippingAmount: (fields[11] as num).toDouble(),
      totalAmount: (fields[12] as num).toDouble(),
      amountPaid: (fields[13] as num).toDouble(),
      amountRemaining: (fields[14] as num).toDouble(),
      status: fields[15] as InvoiceStatus,
      paymentTerms: fields[16] as String?,
      notes: fields[17] as String?,
      erpnextInvoice: fields[18] as String?,
      createdAt: fields[19] as DateTime,
      updatedAt: fields[20] as DateTime?,
      lastReminderSent: fields[21] as DateTime?,
    );
  }

  @override
  void write(BinaryWriter writer, InvoiceModel obj) {
    writer
      ..writeByte(22)
      ..writeByte(0)
      ..write(obj.invoiceId)
      ..writeByte(1)
      ..write(obj.invoiceNumber)
      ..writeByte(2)
      ..write(obj.userId)
      ..writeByte(3)
      ..write(obj.orderId)
      ..writeByte(4)
      ..write(obj.invoiceType)
      ..writeByte(5)
      ..write(obj.issueDate)
      ..writeByte(6)
      ..write(obj.dueDate)
      ..writeByte(7)
      ..write(obj.currency)
      ..writeByte(8)
      ..write(obj.subtotalAmount)
      ..writeByte(9)
      ..write(obj.taxAmount)
      ..writeByte(10)
      ..write(obj.discountAmount)
      ..writeByte(11)
      ..write(obj.shippingAmount)
      ..writeByte(12)
      ..write(obj.totalAmount)
      ..writeByte(13)
      ..write(obj.amountPaid)
      ..writeByte(14)
      ..write(obj.amountRemaining)
      ..writeByte(15)
      ..write(obj.status)
      ..writeByte(16)
      ..write(obj.paymentTerms)
      ..writeByte(17)
      ..write(obj.notes)
      ..writeByte(18)
      ..write(obj.erpnextInvoice)
      ..writeByte(19)
      ..write(obj.createdAt)
      ..writeByte(20)
      ..write(obj.updatedAt)
      ..writeByte(21)
      ..write(obj.lastReminderSent);
  }

  @override
  int get hashCode => typeId.hashCode;

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