part of 'generated.dart';

class UpdateUserVariablesBuilder {
  String id;
  Optional<String> _email = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _fullName = Optional.optional(nativeFromJson, nativeToJson);
  Optional<UserBaseRole> _role = Optional.optional((data) => UserBaseRole.values.byName(data), enumSerializer);
  Optional<String> _userRole = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _photoUrl = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  UpdateUserVariablesBuilder email(String? t) {
   _email.value = t;
   return this;
  }
  UpdateUserVariablesBuilder fullName(String? t) {
   _fullName.value = t;
   return this;
  }
  UpdateUserVariablesBuilder role(UserBaseRole? t) {
   _role.value = t;
   return this;
  }
  UpdateUserVariablesBuilder userRole(String? t) {
   _userRole.value = t;
   return this;
  }
  UpdateUserVariablesBuilder photoUrl(String? t) {
   _photoUrl.value = t;
   return this;
  }

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

  MutationRef<UpdateUserData, UpdateUserVariables> ref() {
    UpdateUserVariables vars= UpdateUserVariables(id: id,email: _email,fullName: _fullName,role: _role,userRole: _userRole,photoUrl: _photoUrl,);
    return _dataConnect.mutation("UpdateUser", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final UpdateUserData otherTyped = other as UpdateUserData;
    return user_update == otherTyped.user_update;
    
  }
  @override
  int get hashCode => user_update.hashCode;
  

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

  UpdateUserData({
    this.user_update,
  });
}

@immutable
class UpdateUserVariables {
  final String id;
  late final Optional<String>email;
  late final Optional<String>fullName;
  late final Optional<UserBaseRole>role;
  late final Optional<String>userRole;
  late final Optional<String>photoUrl;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateUserVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']) {
  
  
  
    email = Optional.optional(nativeFromJson, nativeToJson);
    email.value = json['email'] == null ? null : nativeFromJson<String>(json['email']);
  
  
    fullName = Optional.optional(nativeFromJson, nativeToJson);
    fullName.value = json['fullName'] == null ? null : nativeFromJson<String>(json['fullName']);
  
  
    role = Optional.optional((data) => UserBaseRole.values.byName(data), enumSerializer);
    role.value = json['role'] == null ? null : UserBaseRole.values.byName(json['role']);
  
  
    userRole = Optional.optional(nativeFromJson, nativeToJson);
    userRole.value = json['userRole'] == null ? null : nativeFromJson<String>(json['userRole']);
  
  
    photoUrl = Optional.optional(nativeFromJson, nativeToJson);
    photoUrl.value = json['photoUrl'] == null ? null : nativeFromJson<String>(json['photoUrl']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateUserVariables otherTyped = other as UpdateUserVariables;
    return id == otherTyped.id && 
    email == otherTyped.email && 
    fullName == otherTyped.fullName && 
    role == otherTyped.role && 
    userRole == otherTyped.userRole && 
    photoUrl == otherTyped.photoUrl;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, email.hashCode, fullName.hashCode, role.hashCode, userRole.hashCode, photoUrl.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(email.state == OptionalState.set) {
      json['email'] = email.toJson();
    }
    if(fullName.state == OptionalState.set) {
      json['fullName'] = fullName.toJson();
    }
    if(role.state == OptionalState.set) {
      json['role'] = role.toJson();
    }
    if(userRole.state == OptionalState.set) {
      json['userRole'] = userRole.toJson();
    }
    if(photoUrl.state == OptionalState.set) {
      json['photoUrl'] = photoUrl.toJson();
    }
    return json;
  }

  UpdateUserVariables({
    required this.id,
    required this.email,
    required this.fullName,
    required this.role,
    required this.userRole,
    required this.photoUrl,
  });
}

