part of 'generated.dart';

class UpdateLevelVariablesBuilder {
  String id;
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _xpRequired = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _icon = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _colors = Optional.optional(AnyValue.fromJson, defaultSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateLevelVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  UpdateLevelVariablesBuilder xpRequired(int? t) {
   _xpRequired.value = t;
   return this;
  }
  UpdateLevelVariablesBuilder icon(String? t) {
   _icon.value = t;
   return this;
  }
  UpdateLevelVariablesBuilder colors(AnyValue? t) {
   _colors.value = t;
   return this;
  }

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

  MutationRef<UpdateLevelData, UpdateLevelVariables> ref() {
    UpdateLevelVariables vars= UpdateLevelVariables(id: id,name: _name,xpRequired: _xpRequired,icon: _icon,colors: _colors,);
    return _dataConnect.mutation("updateLevel", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateLevelData otherTyped = other as UpdateLevelData;
    return level_update == otherTyped.level_update;
    
  }
  @override
  int get hashCode => level_update.hashCode;
  

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

  UpdateLevelData({
    this.level_update,
  });
}

@immutable
class UpdateLevelVariables {
  final String id;
  late final Optional<String>name;
  late final Optional<int>xpRequired;
  late final Optional<String>icon;
  late final Optional<AnyValue>colors;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateLevelVariables.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']);
  
  
    xpRequired = Optional.optional(nativeFromJson, nativeToJson);
    xpRequired.value = json['xpRequired'] == null ? null : nativeFromJson<int>(json['xpRequired']);
  
  
    icon = Optional.optional(nativeFromJson, nativeToJson);
    icon.value = json['icon'] == null ? null : nativeFromJson<String>(json['icon']);
  
  
    colors = Optional.optional(AnyValue.fromJson, defaultSerializer);
    colors.value = json['colors'] == null ? null : AnyValue.fromJson(json['colors']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateLevelVariables otherTyped = other as UpdateLevelVariables;
    return id == otherTyped.id && 
    name == otherTyped.name && 
    xpRequired == otherTyped.xpRequired && 
    icon == otherTyped.icon && 
    colors == otherTyped.colors;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, name.hashCode, xpRequired.hashCode, icon.hashCode, colors.hashCode]);
  

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

  UpdateLevelVariables({
    required this.id,
    required this.name,
    required this.xpRequired,
    required this.icon,
    required this.colors,
  });
}

