part of 'generated.dart';

class CreateInvoiceVariablesBuilder {
  InvoiceStatus status;
  String vendorId;
  String businessId;
  String orderId;
  Optional<InovicePaymentTerms> _paymentTerms = Optional.optional((data) => InovicePaymentTerms.values.byName(data), enumSerializer);
  String invoiceNumber;
  Timestamp issueDate;
  Timestamp dueDate;
  Optional<String> _hub = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _managerName = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _vendorNumber = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _roles = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<AnyValue> _charges = Optional.optional(AnyValue.fromJson, defaultSerializer);
  Optional<double> _otherCharges = Optional.optional(nativeFromJson, nativeToJson);
  Optional<double> _subtotal = Optional.optional(nativeFromJson, nativeToJson);
  double amount;
  Optional<String> _notes = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _staffCount = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _chargesCount = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  CreateInvoiceVariablesBuilder paymentTerms(InovicePaymentTerms? t) {
   _paymentTerms.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder hub(String? t) {
   _hub.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder managerName(String? t) {
   _managerName.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder vendorNumber(String? t) {
   _vendorNumber.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder roles(AnyValue? t) {
   _roles.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder charges(AnyValue? t) {
   _charges.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder otherCharges(double? t) {
   _otherCharges.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder subtotal(double? t) {
   _subtotal.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder notes(String? t) {
   _notes.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder staffCount(int? t) {
   _staffCount.value = t;
   return this;
  }
  CreateInvoiceVariablesBuilder chargesCount(int? t) {
   _chargesCount.value = t;
   return this;
  }

  CreateInvoiceVariablesBuilder(this._dataConnect, {required  this.status,required  this.vendorId,required  this.businessId,required  this.orderId,required  this.invoiceNumber,required  this.issueDate,required  this.dueDate,required  this.amount,});
  Deserializer<CreateInvoiceData> dataDeserializer = (dynamic json)  => CreateInvoiceData.fromJson(jsonDecode(json));
  Serializer<CreateInvoiceVariables> varsSerializer = (CreateInvoiceVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateInvoiceData, CreateInvoiceVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateInvoiceData, CreateInvoiceVariables> ref() {
    CreateInvoiceVariables vars= CreateInvoiceVariables(status: status,vendorId: vendorId,businessId: businessId,orderId: orderId,paymentTerms: _paymentTerms,invoiceNumber: invoiceNumber,issueDate: issueDate,dueDate: dueDate,hub: _hub,managerName: _managerName,vendorNumber: _vendorNumber,roles: _roles,charges: _charges,otherCharges: _otherCharges,subtotal: _subtotal,amount: amount,notes: _notes,staffCount: _staffCount,chargesCount: _chargesCount,);
    return _dataConnect.mutation("createInvoice", dataDeserializer, varsSerializer, vars);
  }
}

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

    final CreateInvoiceInvoiceInsert otherTyped = other as CreateInvoiceInvoiceInsert;
    return id == otherTyped.id;
    
  }
  @override
  int get hashCode => id.hashCode;
  

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

  CreateInvoiceInvoiceInsert({
    required this.id,
  });
}

@immutable
class CreateInvoiceData {
  final CreateInvoiceInvoiceInsert invoice_insert;
  CreateInvoiceData.fromJson(dynamic json):
  
  invoice_insert = CreateInvoiceInvoiceInsert.fromJson(json['invoice_insert']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateInvoiceData otherTyped = other as CreateInvoiceData;
    return invoice_insert == otherTyped.invoice_insert;
    
  }
  @override
  int get hashCode => invoice_insert.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['invoice_insert'] = invoice_insert.toJson();
    return json;
  }

  CreateInvoiceData({
    required this.invoice_insert,
  });
}

@immutable
class CreateInvoiceVariables {
  final InvoiceStatus status;
  final String vendorId;
  final String businessId;
  final String orderId;
  late final Optional<InovicePaymentTerms>paymentTerms;
  final String invoiceNumber;
  final Timestamp issueDate;
  final Timestamp dueDate;
  late final Optional<String>hub;
  late final Optional<String>managerName;
  late final Optional<String>vendorNumber;
  late final Optional<AnyValue>roles;
  late final Optional<AnyValue>charges;
  late final Optional<double>otherCharges;
  late final Optional<double>subtotal;
  final double amount;
  late final Optional<String>notes;
  late final Optional<int>staffCount;
  late final Optional<int>chargesCount;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateInvoiceVariables.fromJson(Map<String, dynamic> json):
  
  status = InvoiceStatus.values.byName(json['status']),
  vendorId = nativeFromJson<String>(json['vendorId']),
  businessId = nativeFromJson<String>(json['businessId']),
  orderId = nativeFromJson<String>(json['orderId']),
  invoiceNumber = nativeFromJson<String>(json['invoiceNumber']),
  issueDate = Timestamp.fromJson(json['issueDate']),
  dueDate = Timestamp.fromJson(json['dueDate']),
  amount = nativeFromJson<double>(json['amount']) {
  
  
  
  
  
  
    paymentTerms = Optional.optional((data) => InovicePaymentTerms.values.byName(data), enumSerializer);
    paymentTerms.value = json['paymentTerms'] == null ? null : InovicePaymentTerms.values.byName(json['paymentTerms']);
  
  
  
  
  
    hub = Optional.optional(nativeFromJson, nativeToJson);
    hub.value = json['hub'] == null ? null : nativeFromJson<String>(json['hub']);
  
  
    managerName = Optional.optional(nativeFromJson, nativeToJson);
    managerName.value = json['managerName'] == null ? null : nativeFromJson<String>(json['managerName']);
  
  
    vendorNumber = Optional.optional(nativeFromJson, nativeToJson);
    vendorNumber.value = json['vendorNumber'] == null ? null : nativeFromJson<String>(json['vendorNumber']);
  
  
    roles = Optional.optional(AnyValue.fromJson, defaultSerializer);
    roles.value = json['roles'] == null ? null : AnyValue.fromJson(json['roles']);
  
  
    charges = Optional.optional(AnyValue.fromJson, defaultSerializer);
    charges.value = json['charges'] == null ? null : AnyValue.fromJson(json['charges']);
  
  
    otherCharges = Optional.optional(nativeFromJson, nativeToJson);
    otherCharges.value = json['otherCharges'] == null ? null : nativeFromJson<double>(json['otherCharges']);
  
  
    subtotal = Optional.optional(nativeFromJson, nativeToJson);
    subtotal.value = json['subtotal'] == null ? null : nativeFromJson<double>(json['subtotal']);
  
  
  
    notes = Optional.optional(nativeFromJson, nativeToJson);
    notes.value = json['notes'] == null ? null : nativeFromJson<String>(json['notes']);
  
  
    staffCount = Optional.optional(nativeFromJson, nativeToJson);
    staffCount.value = json['staffCount'] == null ? null : nativeFromJson<int>(json['staffCount']);
  
  
    chargesCount = Optional.optional(nativeFromJson, nativeToJson);
    chargesCount.value = json['chargesCount'] == null ? null : nativeFromJson<int>(json['chargesCount']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateInvoiceVariables otherTyped = other as CreateInvoiceVariables;
    return 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;
    
  }
  @override
  int get hashCode => Object.hashAll([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]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['status'] = 
    status.name
    ;
    json['vendorId'] = nativeToJson<String>(vendorId);
    json['businessId'] = nativeToJson<String>(businessId);
    json['orderId'] = nativeToJson<String>(orderId);
    if(paymentTerms.state == OptionalState.set) {
      json['paymentTerms'] = paymentTerms.toJson();
    }
    json['invoiceNumber'] = nativeToJson<String>(invoiceNumber);
    json['issueDate'] = issueDate.toJson();
    json['dueDate'] = dueDate.toJson();
    if(hub.state == OptionalState.set) {
      json['hub'] = hub.toJson();
    }
    if(managerName.state == OptionalState.set) {
      json['managerName'] = managerName.toJson();
    }
    if(vendorNumber.state == OptionalState.set) {
      json['vendorNumber'] = vendorNumber.toJson();
    }
    if(roles.state == OptionalState.set) {
      json['roles'] = roles.toJson();
    }
    if(charges.state == OptionalState.set) {
      json['charges'] = charges.toJson();
    }
    if(otherCharges.state == OptionalState.set) {
      json['otherCharges'] = otherCharges.toJson();
    }
    if(subtotal.state == OptionalState.set) {
      json['subtotal'] = subtotal.toJson();
    }
    json['amount'] = nativeToJson<double>(amount);
    if(notes.state == OptionalState.set) {
      json['notes'] = notes.toJson();
    }
    if(staffCount.state == OptionalState.set) {
      json['staffCount'] = staffCount.toJson();
    }
    if(chargesCount.state == OptionalState.set) {
      json['chargesCount'] = chargesCount.toJson();
    }
    return json;
  }

  CreateInvoiceVariables({
    required this.status,
    required this.vendorId,
    required this.businessId,
    required this.orderId,
    required this.paymentTerms,
    required this.invoiceNumber,
    required this.issueDate,
    required this.dueDate,
    required this.hub,
    required this.managerName,
    required this.vendorNumber,
    required this.roles,
    required this.charges,
    required this.otherCharges,
    required this.subtotal,
    required this.amount,
    required this.notes,
    required this.staffCount,
    required this.chargesCount,
  });
}

