part of 'generated.dart';

class CreateLevelVariablesBuilder {
  String name;
  int xpRequired;
  Optional<String> _icon = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _colors = Optional.optional(AnyValue.fromJson, defaultSerializer);

  final FirebaseDataConnect _dataConnect;  CreateLevelVariablesBuilder icon(String? t) {
   _icon.value = t;
   return this;
  }
  CreateLevelVariablesBuilder colors(AnyValue? t) {
   _colors.value = t;
   return this;
  }

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

  MutationRef<CreateLevelData, CreateLevelVariables> ref() {
    CreateLevelVariables vars= CreateLevelVariables(name: name,xpRequired: xpRequired,icon: _icon,colors: _colors,);
    return _dataConnect.mutation("createLevel", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateLevelData otherTyped = other as CreateLevelData;
    return level_insert == otherTyped.level_insert;
    
  }
  @override
  int get hashCode => level_insert.hashCode;
  

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

  CreateLevelData({
    required this.level_insert,
  });
}

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

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

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

