part of 'generated.dart';

class ListOverdueInvoicesVariablesBuilder {
  Timestamp now;
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  ListOverdueInvoicesVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  ListOverdueInvoicesVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

  ListOverdueInvoicesVariablesBuilder(this._dataConnect, {required  this.now,});
  Deserializer<ListOverdueInvoicesData> dataDeserializer = (dynamic json)  => ListOverdueInvoicesData.fromJson(jsonDecode(json));
  Serializer<ListOverdueInvoicesVariables> varsSerializer = (ListOverdueInvoicesVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListOverdueInvoicesData, ListOverdueInvoicesVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListOverdueInvoicesData, ListOverdueInvoicesVariables> ref() {
    ListOverdueInvoicesVariables vars= ListOverdueInvoicesVariables(now: now,offset: _offset,limit: _limit,);
    return _dataConnect.query("listOverdueInvoices", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListOverdueInvoicesInvoices {
  final String id;
  final EnumValue<InvoiceStatus> status;
  final String vendorId;
  final String businessId;
  final String orderId;
  final EnumValue<InovicePaymentTerms>? paymentTerms;
  final String invoiceNumber;
  final Timestamp issueDate;
  final Timestamp dueDate;
  final String? hub;
  final String? managerName;
  final String? vendorNumber;
  final AnyValue? roles;
  final AnyValue? charges;
  final double? otherCharges;
  final double? subtotal;
  final double amount;
  final String? notes;
  final int? staffCount;
  final int? chargesCount;
  final AnyValue? disputedItems;
  final String? disputeReason;
  final String? disputeDetails;
  final ListOverdueInvoicesInvoicesVendor vendor;
  final ListOverdueInvoicesInvoicesBusiness business;
  final ListOverdueInvoicesInvoicesOrder order;
  ListOverdueInvoicesInvoices.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  status = invoiceStatusDeserializer(json['status']),
  vendorId = nativeFromJson<String>(json['vendorId']),
  businessId = nativeFromJson<String>(json['businessId']),
  orderId = nativeFromJson<String>(json['orderId']),
  paymentTerms = json['paymentTerms'] == null ? null : inovicePaymentTermsDeserializer(json['paymentTerms']),
  invoiceNumber = nativeFromJson<String>(json['invoiceNumber']),
  issueDate = Timestamp.fromJson(json['issueDate']),
  dueDate = Timestamp.fromJson(json['dueDate']),
  hub = json['hub'] == null ? null : nativeFromJson<String>(json['hub']),
  managerName = json['managerName'] == null ? null : nativeFromJson<String>(json['managerName']),
  vendorNumber = json['vendorNumber'] == null ? null : nativeFromJson<String>(json['vendorNumber']),
  roles = json['roles'] == null ? null : AnyValue.fromJson(json['roles']),
  charges = json['charges'] == null ? null : AnyValue.fromJson(json['charges']),
  otherCharges = json['otherCharges'] == null ? null : nativeFromJson<double>(json['otherCharges']),
  subtotal = json['subtotal'] == null ? null : nativeFromJson<double>(json['subtotal']),
  amount = nativeFromJson<double>(json['amount']),
  notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
  staffCount = json['staffCount'] == null ? null : nativeFromJson<int>(json['staffCount']),
  chargesCount = json['chargesCount'] == null ? null : nativeFromJson<int>(json['chargesCount']),
  disputedItems = json['disputedItems'] == null ? null : AnyValue.fromJson(json['disputedItems']),
  disputeReason = json['disputeReason'] == null ? null : nativeFromJson<String>(json['disputeReason']),
  disputeDetails = json['disputeDetails'] == null ? null : nativeFromJson<String>(json['disputeDetails']),
  vendor = ListOverdueInvoicesInvoicesVendor.fromJson(json['vendor']),
  business = ListOverdueInvoicesInvoicesBusiness.fromJson(json['business']),
  order = ListOverdueInvoicesInvoicesOrder.fromJson(json['order']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesInvoices otherTyped = other as ListOverdueInvoicesInvoices;
    return id == otherTyped.id && 
    status == otherTyped.status && 
    vendorId == otherTyped.vendorId && 
    businessId == otherTyped.businessId && 
    orderId == otherTyped.orderId && 
    paymentTerms == otherTyped.paymentTerms && 
    invoiceNumber == otherTyped.invoiceNumber && 
    issueDate == otherTyped.issueDate && 
    dueDate == otherTyped.dueDate && 
    hub == otherTyped.hub && 
    managerName == otherTyped.managerName && 
    vendorNumber == otherTyped.vendorNumber && 
    roles == otherTyped.roles && 
    charges == otherTyped.charges && 
    otherCharges == otherTyped.otherCharges && 
    subtotal == otherTyped.subtotal && 
    amount == otherTyped.amount && 
    notes == otherTyped.notes && 
    staffCount == otherTyped.staffCount && 
    chargesCount == otherTyped.chargesCount && 
    disputedItems == otherTyped.disputedItems && 
    disputeReason == otherTyped.disputeReason && 
    disputeDetails == otherTyped.disputeDetails && 
    vendor == otherTyped.vendor && 
    business == otherTyped.business && 
    order == otherTyped.order;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, status.hashCode, vendorId.hashCode, businessId.hashCode, orderId.hashCode, paymentTerms.hashCode, invoiceNumber.hashCode, issueDate.hashCode, dueDate.hashCode, hub.hashCode, managerName.hashCode, vendorNumber.hashCode, roles.hashCode, charges.hashCode, otherCharges.hashCode, subtotal.hashCode, amount.hashCode, notes.hashCode, staffCount.hashCode, chargesCount.hashCode, disputedItems.hashCode, disputeReason.hashCode, disputeDetails.hashCode, vendor.hashCode, business.hashCode, order.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['status'] = 
    invoiceStatusSerializer(status)
    ;
    json['vendorId'] = nativeToJson<String>(vendorId);
    json['businessId'] = nativeToJson<String>(businessId);
    json['orderId'] = nativeToJson<String>(orderId);
    if (paymentTerms != null) {
      json['paymentTerms'] = 
    inovicePaymentTermsSerializer(paymentTerms!)
    ;
    }
    json['invoiceNumber'] = nativeToJson<String>(invoiceNumber);
    json['issueDate'] = issueDate.toJson();
    json['dueDate'] = dueDate.toJson();
    if (hub != null) {
      json['hub'] = nativeToJson<String?>(hub);
    }
    if (managerName != null) {
      json['managerName'] = nativeToJson<String?>(managerName);
    }
    if (vendorNumber != null) {
      json['vendorNumber'] = nativeToJson<String?>(vendorNumber);
    }
    if (roles != null) {
      json['roles'] = roles!.toJson();
    }
    if (charges != null) {
      json['charges'] = charges!.toJson();
    }
    if (otherCharges != null) {
      json['otherCharges'] = nativeToJson<double?>(otherCharges);
    }
    if (subtotal != null) {
      json['subtotal'] = nativeToJson<double?>(subtotal);
    }
    json['amount'] = nativeToJson<double>(amount);
    if (notes != null) {
      json['notes'] = nativeToJson<String?>(notes);
    }
    if (staffCount != null) {
      json['staffCount'] = nativeToJson<int?>(staffCount);
    }
    if (chargesCount != null) {
      json['chargesCount'] = nativeToJson<int?>(chargesCount);
    }
    if (disputedItems != null) {
      json['disputedItems'] = disputedItems!.toJson();
    }
    if (disputeReason != null) {
      json['disputeReason'] = nativeToJson<String?>(disputeReason);
    }
    if (disputeDetails != null) {
      json['disputeDetails'] = nativeToJson<String?>(disputeDetails);
    }
    json['vendor'] = vendor.toJson();
    json['business'] = business.toJson();
    json['order'] = order.toJson();
    return json;
  }

  ListOverdueInvoicesInvoices({
    required this.id,
    required this.status,
    required this.vendorId,
    required this.businessId,
    required this.orderId,
    this.paymentTerms,
    required this.invoiceNumber,
    required this.issueDate,
    required this.dueDate,
    this.hub,
    this.managerName,
    this.vendorNumber,
    this.roles,
    this.charges,
    this.otherCharges,
    this.subtotal,
    required this.amount,
    this.notes,
    this.staffCount,
    this.chargesCount,
    this.disputedItems,
    this.disputeReason,
    this.disputeDetails,
    required this.vendor,
    required this.business,
    required this.order,
  });
}

@immutable
class ListOverdueInvoicesInvoicesVendor {
  final String companyName;
  final String? address;
  final String? email;
  final String? phone;
  ListOverdueInvoicesInvoicesVendor.fromJson(dynamic json):
  
  companyName = nativeFromJson<String>(json['companyName']),
  address = json['address'] == null ? null : nativeFromJson<String>(json['address']),
  email = json['email'] == null ? null : nativeFromJson<String>(json['email']),
  phone = json['phone'] == null ? null : nativeFromJson<String>(json['phone']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesInvoicesVendor otherTyped = other as ListOverdueInvoicesInvoicesVendor;
    return companyName == otherTyped.companyName && 
    address == otherTyped.address && 
    email == otherTyped.email && 
    phone == otherTyped.phone;
    
  }
  @override
  int get hashCode => Object.hashAll([companyName.hashCode, address.hashCode, email.hashCode, phone.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['companyName'] = nativeToJson<String>(companyName);
    if (address != null) {
      json['address'] = nativeToJson<String?>(address);
    }
    if (email != null) {
      json['email'] = nativeToJson<String?>(email);
    }
    if (phone != null) {
      json['phone'] = nativeToJson<String?>(phone);
    }
    return json;
  }

  ListOverdueInvoicesInvoicesVendor({
    required this.companyName,
    this.address,
    this.email,
    this.phone,
  });
}

@immutable
class ListOverdueInvoicesInvoicesBusiness {
  final String businessName;
  final String? address;
  final String? phone;
  final String? email;
  ListOverdueInvoicesInvoicesBusiness.fromJson(dynamic json):
  
  businessName = nativeFromJson<String>(json['businessName']),
  address = json['address'] == null ? null : nativeFromJson<String>(json['address']),
  phone = json['phone'] == null ? null : nativeFromJson<String>(json['phone']),
  email = json['email'] == null ? null : nativeFromJson<String>(json['email']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesInvoicesBusiness otherTyped = other as ListOverdueInvoicesInvoicesBusiness;
    return businessName == otherTyped.businessName && 
    address == otherTyped.address && 
    phone == otherTyped.phone && 
    email == otherTyped.email;
    
  }
  @override
  int get hashCode => Object.hashAll([businessName.hashCode, address.hashCode, phone.hashCode, email.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['businessName'] = nativeToJson<String>(businessName);
    if (address != null) {
      json['address'] = nativeToJson<String?>(address);
    }
    if (phone != null) {
      json['phone'] = nativeToJson<String?>(phone);
    }
    if (email != null) {
      json['email'] = nativeToJson<String?>(email);
    }
    return json;
  }

  ListOverdueInvoicesInvoicesBusiness({
    required this.businessName,
    this.address,
    this.phone,
    this.email,
  });
}

@immutable
class ListOverdueInvoicesInvoicesOrder {
  final String? eventName;
  final String? hub;
  final String? deparment;
  final String? poReference;
  ListOverdueInvoicesInvoicesOrder.fromJson(dynamic json):
  
  eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
  hub = json['hub'] == null ? null : nativeFromJson<String>(json['hub']),
  deparment = json['deparment'] == null ? null : nativeFromJson<String>(json['deparment']),
  poReference = json['poReference'] == null ? null : nativeFromJson<String>(json['poReference']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesInvoicesOrder otherTyped = other as ListOverdueInvoicesInvoicesOrder;
    return eventName == otherTyped.eventName && 
    hub == otherTyped.hub && 
    deparment == otherTyped.deparment && 
    poReference == otherTyped.poReference;
    
  }
  @override
  int get hashCode => Object.hashAll([eventName.hashCode, hub.hashCode, deparment.hashCode, poReference.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (eventName != null) {
      json['eventName'] = nativeToJson<String?>(eventName);
    }
    if (hub != null) {
      json['hub'] = nativeToJson<String?>(hub);
    }
    if (deparment != null) {
      json['deparment'] = nativeToJson<String?>(deparment);
    }
    if (poReference != null) {
      json['poReference'] = nativeToJson<String?>(poReference);
    }
    return json;
  }

  ListOverdueInvoicesInvoicesOrder({
    this.eventName,
    this.hub,
    this.deparment,
    this.poReference,
  });
}

@immutable
class ListOverdueInvoicesData {
  final List<ListOverdueInvoicesInvoices> invoices;
  ListOverdueInvoicesData.fromJson(dynamic json):
  
  invoices = (json['invoices'] as List<dynamic>)
        .map((e) => ListOverdueInvoicesInvoices.fromJson(e))
        .toList();
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesData otherTyped = other as ListOverdueInvoicesData;
    return invoices == otherTyped.invoices;
    
  }
  @override
  int get hashCode => invoices.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['invoices'] = invoices.map((e) => e.toJson()).toList();
    return json;
  }

  ListOverdueInvoicesData({
    required this.invoices,
  });
}

@immutable
class ListOverdueInvoicesVariables {
  final Timestamp now;
  late final Optional<int>offset;
  late final Optional<int>limit;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  ListOverdueInvoicesVariables.fromJson(Map<String, dynamic> json):
  
  now = Timestamp.fromJson(json['now']) {
  
  
  
    offset = Optional.optional(nativeFromJson, nativeToJson);
    offset.value = json['offset'] == null ? null : nativeFromJson<int>(json['offset']);
  
  
    limit = Optional.optional(nativeFromJson, nativeToJson);
    limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListOverdueInvoicesVariables otherTyped = other as ListOverdueInvoicesVariables;
    return now == otherTyped.now && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([now.hashCode, offset.hashCode, limit.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['now'] = now.toJson();
    if(offset.state == OptionalState.set) {
      json['offset'] = offset.toJson();
    }
    if(limit.state == OptionalState.set) {
      json['limit'] = limit.toJson();
    }
    return json;
  }

  ListOverdueInvoicesVariables({
    required this.now,
    required this.offset,
    required this.limit,
  });
}

