part of 'generated.dart';

class ListInvoiceTemplatesByBusinessIdVariablesBuilder {
  String businessId;
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

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

  ListInvoiceTemplatesByBusinessIdVariablesBuilder(this._dataConnect, {required  this.businessId,});
  Deserializer<ListInvoiceTemplatesByBusinessIdData> dataDeserializer = (dynamic json)  => ListInvoiceTemplatesByBusinessIdData.fromJson(jsonDecode(json));
  Serializer<ListInvoiceTemplatesByBusinessIdVariables> varsSerializer = (ListInvoiceTemplatesByBusinessIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListInvoiceTemplatesByBusinessIdData, ListInvoiceTemplatesByBusinessIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListInvoiceTemplatesByBusinessIdData, ListInvoiceTemplatesByBusinessIdVariables> ref() {
    ListInvoiceTemplatesByBusinessIdVariables vars= ListInvoiceTemplatesByBusinessIdVariables(businessId: businessId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listInvoiceTemplatesByBusinessId", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListInvoiceTemplatesByBusinessIdInvoiceTemplates {
  final String id;
  final String name;
  final String ownerId;
  final String? vendorId;
  final String? businessId;
  final String? orderId;
  final EnumValue<InovicePaymentTermsTemp>? 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 Timestamp? createdAt;
  final Timestamp? updatedAt;
  final String? createdBy;
  final ListInvoiceTemplatesByBusinessIdInvoiceTemplatesVendor? vendor;
  final ListInvoiceTemplatesByBusinessIdInvoiceTemplatesBusiness? business;
  final ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder? order;
  ListInvoiceTemplatesByBusinessIdInvoiceTemplates.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  name = nativeFromJson<String>(json['name']),
  ownerId = nativeFromJson<String>(json['ownerId']),
  vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
  businessId = json['businessId'] == null ? null : nativeFromJson<String>(json['businessId']),
  orderId = json['orderId'] == null ? null : nativeFromJson<String>(json['orderId']),
  paymentTerms = json['paymentTerms'] == null ? null : inovicePaymentTermsTempDeserializer(json['paymentTerms']),
  invoiceNumber = json['invoiceNumber'] == null ? null : nativeFromJson<String>(json['invoiceNumber']),
  issueDate = json['issueDate'] == null ? null : Timestamp.fromJson(json['issueDate']),
  dueDate = json['dueDate'] == null ? null : 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 = json['amount'] == null ? null : 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']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']),
  createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']),
  vendor = json['vendor'] == null ? null : ListInvoiceTemplatesByBusinessIdInvoiceTemplatesVendor.fromJson(json['vendor']),
  business = json['business'] == null ? null : ListInvoiceTemplatesByBusinessIdInvoiceTemplatesBusiness.fromJson(json['business']),
  order = json['order'] == null ? null : ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder.fromJson(json['order']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListInvoiceTemplatesByBusinessIdInvoiceTemplates otherTyped = other as ListInvoiceTemplatesByBusinessIdInvoiceTemplates;
    return id == otherTyped.id && 
    name == otherTyped.name && 
    ownerId == otherTyped.ownerId && 
    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 && 
    createdAt == otherTyped.createdAt && 
    updatedAt == otherTyped.updatedAt && 
    createdBy == otherTyped.createdBy && 
    vendor == otherTyped.vendor && 
    business == otherTyped.business && 
    order == otherTyped.order;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, name.hashCode, ownerId.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, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, vendor.hashCode, business.hashCode, order.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['name'] = nativeToJson<String>(name);
    json['ownerId'] = nativeToJson<String>(ownerId);
    if (vendorId != null) {
      json['vendorId'] = nativeToJson<String?>(vendorId);
    }
    if (businessId != null) {
      json['businessId'] = nativeToJson<String?>(businessId);
    }
    if (orderId != null) {
      json['orderId'] = nativeToJson<String?>(orderId);
    }
    if (paymentTerms != null) {
      json['paymentTerms'] = 
    inovicePaymentTermsTempSerializer(paymentTerms!)
    ;
    }
    if (invoiceNumber != null) {
      json['invoiceNumber'] = nativeToJson<String?>(invoiceNumber);
    }
    if (issueDate != null) {
      json['issueDate'] = issueDate!.toJson();
    }
    if (dueDate != null) {
      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);
    }
    if (amount != null) {
      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 (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    if (updatedAt != null) {
      json['updatedAt'] = updatedAt!.toJson();
    }
    if (createdBy != null) {
      json['createdBy'] = nativeToJson<String?>(createdBy);
    }
    if (vendor != null) {
      json['vendor'] = vendor!.toJson();
    }
    if (business != null) {
      json['business'] = business!.toJson();
    }
    if (order != null) {
      json['order'] = order!.toJson();
    }
    return json;
  }

  ListInvoiceTemplatesByBusinessIdInvoiceTemplates({
    required this.id,
    required this.name,
    required this.ownerId,
    this.vendorId,
    this.businessId,
    this.orderId,
    this.paymentTerms,
    this.invoiceNumber,
    this.issueDate,
    this.dueDate,
    this.hub,
    this.managerName,
    this.vendorNumber,
    this.roles,
    this.charges,
    this.otherCharges,
    this.subtotal,
    this.amount,
    this.notes,
    this.staffCount,
    this.chargesCount,
    this.createdAt,
    this.updatedAt,
    this.createdBy,
    this.vendor,
    this.business,
    this.order,
  });
}

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

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['companyName'] = nativeToJson<String>(companyName);
    return json;
  }

  ListInvoiceTemplatesByBusinessIdInvoiceTemplatesVendor({
    required this.id,
    required this.companyName,
  });
}

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

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

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

  ListInvoiceTemplatesByBusinessIdInvoiceTemplatesBusiness({
    required this.id,
    required this.businessName,
    this.email,
    this.contactName,
  });
}

@immutable
class ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder {
  final String id;
  final String? eventName;
  final EnumValue<OrderStatus> status;
  final EnumValue<OrderType> orderType;
  ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
  status = orderStatusDeserializer(json['status']),
  orderType = orderTypeDeserializer(json['orderType']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder otherTyped = other as ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder;
    return id == otherTyped.id && 
    eventName == otherTyped.eventName && 
    status == otherTyped.status && 
    orderType == otherTyped.orderType;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, eventName.hashCode, status.hashCode, orderType.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if (eventName != null) {
      json['eventName'] = nativeToJson<String?>(eventName);
    }
    json['status'] = 
    orderStatusSerializer(status)
    ;
    json['orderType'] = 
    orderTypeSerializer(orderType)
    ;
    return json;
  }

  ListInvoiceTemplatesByBusinessIdInvoiceTemplatesOrder({
    required this.id,
    this.eventName,
    required this.status,
    required this.orderType,
  });
}

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

    final ListInvoiceTemplatesByBusinessIdData otherTyped = other as ListInvoiceTemplatesByBusinessIdData;
    return invoiceTemplates == otherTyped.invoiceTemplates;
    
  }
  @override
  int get hashCode => invoiceTemplates.hashCode;
  

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

  ListInvoiceTemplatesByBusinessIdData({
    required this.invoiceTemplates,
  });
}

@immutable
class ListInvoiceTemplatesByBusinessIdVariables {
  final String businessId;
  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.')
  ListInvoiceTemplatesByBusinessIdVariables.fromJson(Map<String, dynamic> json):
  
  businessId = nativeFromJson<String>(json['businessId']) {
  
  
  
    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 ListInvoiceTemplatesByBusinessIdVariables otherTyped = other as ListInvoiceTemplatesByBusinessIdVariables;
    return businessId == otherTyped.businessId && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([businessId.hashCode, offset.hashCode, limit.hashCode]);
  

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

  ListInvoiceTemplatesByBusinessIdVariables({
    required this.businessId,
    required this.offset,
    required this.limit,
  });
}

