part of 'generated.dart';

class CreateUserConversationVariablesBuilder {
  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;  CreateUserConversationVariablesBuilder unreadCount(int? t) {
   _unreadCount.value = t;
   return this;
  }
  CreateUserConversationVariablesBuilder lastReadAt(Timestamp? t) {
   _lastReadAt.value = t;
   return this;
  }

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

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

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

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

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

    final CreateUserConversationData otherTyped = other as CreateUserConversationData;
    return userConversation_insert == otherTyped.userConversation_insert;
    
  }
  @override
  int get hashCode => userConversation_insert.hashCode;
  

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

  CreateUserConversationData({
    required this.userConversation_insert,
  });
}

@immutable
class CreateUserConversationVariables {
  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.')
  CreateUserConversationVariables.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 CreateUserConversationVariables otherTyped = other as CreateUserConversationVariables;
    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;
  }

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

