part of 'generated.dart';

class UpdateUserConversationVariablesBuilder {
  String conversationId;
  String userId;
  Optional<int> _unreadCount = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _lastReadAt = Optional.optional((json) => json['lastReadAt'] = Timestamp.fromJson(json['lastReadAt']), defaultSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateUserConversationVariablesBuilder unreadCount(int? t) {
   _unreadCount.value = t;
   return this;
  }
  UpdateUserConversationVariablesBuilder lastReadAt(Timestamp? t) {
   _lastReadAt.value = t;
   return this;
  }

  UpdateUserConversationVariablesBuilder(this._dataConnect, {required  this.conversationId,required  this.userId,});
  Deserializer<UpdateUserConversationData> dataDeserializer = (dynamic json)  => UpdateUserConversationData.fromJson(jsonDecode(json));
  Serializer<UpdateUserConversationVariables> varsSerializer = (UpdateUserConversationVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateUserConversationData, UpdateUserConversationVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateUserConversationData, UpdateUserConversationVariables> ref() {
    UpdateUserConversationVariables vars= UpdateUserConversationVariables(conversationId: conversationId,userId: userId,unreadCount: _unreadCount,lastReadAt: _lastReadAt,);
    return _dataConnect.mutation("updateUserConversation", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateUserConversationUserConversationUpdate {
  final String conversationId;
  final String userId;
  UpdateUserConversationUserConversationUpdate.fromJson(dynamic json):
  
  conversationId = nativeFromJson<String>(json['conversationId']),
  userId = nativeFromJson<String>(json['userId']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateUserConversationUserConversationUpdate otherTyped = other as UpdateUserConversationUserConversationUpdate;
    return conversationId == otherTyped.conversationId && 
    userId == otherTyped.userId;
    
  }
  @override
  int get hashCode => Object.hashAll([conversationId.hashCode, userId.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['conversationId'] = nativeToJson<String>(conversationId);
    json['userId'] = nativeToJson<String>(userId);
    return json;
  }

  UpdateUserConversationUserConversationUpdate({
    required this.conversationId,
    required this.userId,
  });
}

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

    final UpdateUserConversationData otherTyped = other as UpdateUserConversationData;
    return userConversation_update == otherTyped.userConversation_update;
    
  }
  @override
  int get hashCode => userConversation_update.hashCode;
  

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

  UpdateUserConversationData({
    this.userConversation_update,
  });
}

@immutable
class UpdateUserConversationVariables {
  final String conversationId;
  final String userId;
  late final Optional<int>unreadCount;
  late final Optional<Timestamp>lastReadAt;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateUserConversationVariables.fromJson(Map<String, dynamic> json):
  
  conversationId = nativeFromJson<String>(json['conversationId']),
  userId = nativeFromJson<String>(json['userId']) {
  
  
  
  
    unreadCount = Optional.optional(nativeFromJson, nativeToJson);
    unreadCount.value = json['unreadCount'] == null ? null : nativeFromJson<int>(json['unreadCount']);
  
  
    lastReadAt = Optional.optional((json) => json['lastReadAt'] = Timestamp.fromJson(json['lastReadAt']), defaultSerializer);
    lastReadAt.value = json['lastReadAt'] == null ? null : Timestamp.fromJson(json['lastReadAt']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateUserConversationVariables otherTyped = other as UpdateUserConversationVariables;
    return conversationId == otherTyped.conversationId && 
    userId == otherTyped.userId && 
    unreadCount == otherTyped.unreadCount && 
    lastReadAt == otherTyped.lastReadAt;
    
  }
  @override
  int get hashCode => Object.hashAll([conversationId.hashCode, userId.hashCode, unreadCount.hashCode, lastReadAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['conversationId'] = nativeToJson<String>(conversationId);
    json['userId'] = nativeToJson<String>(userId);
    if(unreadCount.state == OptionalState.set) {
      json['unreadCount'] = unreadCount.toJson();
    }
    if(lastReadAt.state == OptionalState.set) {
      json['lastReadAt'] = lastReadAt.toJson();
    }
    return json;
  }

  UpdateUserConversationVariables({
    required this.conversationId,
    required this.userId,
    required this.unreadCount,
    required this.lastReadAt,
  });
}

