part of 'generated.dart';

class UpdateCustomRateCardVariablesBuilder {
  String id;
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _baseBook = Optional.optional(nativeFromJson, nativeToJson);
  Optional<double> _discount = Optional.optional(nativeFromJson, nativeToJson);
  Optional<bool> _isDefault = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  UpdateCustomRateCardVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  UpdateCustomRateCardVariablesBuilder baseBook(String? t) {
   _baseBook.value = t;
   return this;
  }
  UpdateCustomRateCardVariablesBuilder discount(double? t) {
   _discount.value = t;
   return this;
  }
  UpdateCustomRateCardVariablesBuilder isDefault(bool? t) {
   _isDefault.value = t;
   return this;
  }

  UpdateCustomRateCardVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<UpdateCustomRateCardData> dataDeserializer = (dynamic json)  => UpdateCustomRateCardData.fromJson(jsonDecode(json));
  Serializer<UpdateCustomRateCardVariables> varsSerializer = (UpdateCustomRateCardVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateCustomRateCardData, UpdateCustomRateCardVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateCustomRateCardData, UpdateCustomRateCardVariables> ref() {
    UpdateCustomRateCardVariables vars= UpdateCustomRateCardVariables(id: id,name: _name,baseBook: _baseBook,discount: _discount,isDefault: _isDefault,);
    return _dataConnect.mutation("updateCustomRateCard", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateCustomRateCardCustomRateCardUpdate {
  final String id;
  UpdateCustomRateCardCustomRateCardUpdate.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 UpdateCustomRateCardCustomRateCardUpdate otherTyped = other as UpdateCustomRateCardCustomRateCardUpdate;
    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;
  }

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

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

    final UpdateCustomRateCardData otherTyped = other as UpdateCustomRateCardData;
    return customRateCard_update == otherTyped.customRateCard_update;
    
  }
  @override
  int get hashCode => customRateCard_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (customRateCard_update != null) {
      json['customRateCard_update'] = customRateCard_update!.toJson();
    }
    return json;
  }

  UpdateCustomRateCardData({
    this.customRateCard_update,
  });
}

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

    final UpdateCustomRateCardVariables otherTyped = other as UpdateCustomRateCardVariables;
    return id == otherTyped.id && 
    name == otherTyped.name && 
    baseBook == otherTyped.baseBook && 
    discount == otherTyped.discount && 
    isDefault == otherTyped.isDefault;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, name.hashCode, baseBook.hashCode, discount.hashCode, isDefault.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(name.state == OptionalState.set) {
      json['name'] = name.toJson();
    }
    if(baseBook.state == OptionalState.set) {
      json['baseBook'] = baseBook.toJson();
    }
    if(discount.state == OptionalState.set) {
      json['discount'] = discount.toJson();
    }
    if(isDefault.state == OptionalState.set) {
      json['isDefault'] = isDefault.toJson();
    }
    return json;
  }

  UpdateCustomRateCardVariables({
    required this.id,
    required this.name,
    required this.baseBook,
    required this.discount,
    required this.isDefault,
  });
}

