part of 'generated.dart';

class FilterLevelsVariablesBuilder {
  Optional<String> _name = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _xpRequired = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterLevelsVariablesBuilder name(String? t) {
   _name.value = t;
   return this;
  }
  FilterLevelsVariablesBuilder xpRequired(int? t) {
   _xpRequired.value = t;
   return this;
  }

  FilterLevelsVariablesBuilder(this._dataConnect, );
  Deserializer<FilterLevelsData> dataDeserializer = (dynamic json)  => FilterLevelsData.fromJson(jsonDecode(json));
  Serializer<FilterLevelsVariables> varsSerializer = (FilterLevelsVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<FilterLevelsData, FilterLevelsVariables>> execute() {
    return ref().execute();
  }

  QueryRef<FilterLevelsData, FilterLevelsVariables> ref() {
    FilterLevelsVariables vars= FilterLevelsVariables(name: _name,xpRequired: _xpRequired,);
    return _dataConnect.query("filterLevels", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class FilterLevelsLevels {
  final String id;
  final String name;
  final int xpRequired;
  final String? icon;
  final AnyValue? colors;
  FilterLevelsLevels.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  name = nativeFromJson<String>(json['name']),
  xpRequired = nativeFromJson<int>(json['xpRequired']),
  icon = json['icon'] == null ? null : nativeFromJson<String>(json['icon']),
  colors = 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 FilterLevelsLevels otherTyped = other as FilterLevelsLevels;
    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);
    json['name'] = nativeToJson<String>(name);
    json['xpRequired'] = nativeToJson<int>(xpRequired);
    if (icon != null) {
      json['icon'] = nativeToJson<String?>(icon);
    }
    if (colors != null) {
      json['colors'] = colors!.toJson();
    }
    return json;
  }

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

@immutable
class FilterLevelsData {
  final List<FilterLevelsLevels> levels;
  FilterLevelsData.fromJson(dynamic json):
  
  levels = (json['levels'] as List<dynamic>)
        .map((e) => FilterLevelsLevels.fromJson(e))
        .toList();
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterLevelsData otherTyped = other as FilterLevelsData;
    return levels == otherTyped.levels;
    
  }
  @override
  int get hashCode => levels.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['levels'] = levels.map((e) => e.toJson()).toList();
    return json;
  }

  FilterLevelsData({
    required this.levels,
  });
}

@immutable
class FilterLevelsVariables {
  late final Optional<String>name;
  late final Optional<int>xpRequired;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  FilterLevelsVariables.fromJson(Map<String, dynamic> json) {
  
  
    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']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

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

  FilterLevelsVariables({
    required this.name,
    required this.xpRequired,
  });
}

