part of 'generated.dart';

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

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

  CreateCustomRateCardVariablesBuilder(this._dataConnect, {required  this.name,});
  Deserializer<CreateCustomRateCardData> dataDeserializer = (dynamic json)  => CreateCustomRateCardData.fromJson(jsonDecode(json));
  Serializer<CreateCustomRateCardVariables> varsSerializer = (CreateCustomRateCardVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateCustomRateCardData, CreateCustomRateCardVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateCustomRateCardData, CreateCustomRateCardVariables> ref() {
    CreateCustomRateCardVariables vars= CreateCustomRateCardVariables(name: name,baseBook: _baseBook,discount: _discount,isDefault: _isDefault,);
    return _dataConnect.mutation("createCustomRateCard", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateCustomRateCardData otherTyped = other as CreateCustomRateCardData;
    return customRateCard_insert == otherTyped.customRateCard_insert;
    
  }
  @override
  int get hashCode => customRateCard_insert.hashCode;
  

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

  CreateCustomRateCardData({
    required this.customRateCard_insert,
  });
}

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['name'] = nativeToJson<String>(name);
    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;
  }

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

