part of 'generated.dart';

class GetUserConversationByKeyVariablesBuilder {
  String conversationId;
  String userId;

  final FirebaseDataConnect _dataConnect;
  GetUserConversationByKeyVariablesBuilder(this._dataConnect, {required  this.conversationId,required  this.userId,});
  Deserializer<GetUserConversationByKeyData> dataDeserializer = (dynamic json)  => GetUserConversationByKeyData.fromJson(jsonDecode(json));
  Serializer<GetUserConversationByKeyVariables> varsSerializer = (GetUserConversationByKeyVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<GetUserConversationByKeyData, GetUserConversationByKeyVariables>> execute() {
    return ref().execute();
  }

  QueryRef<GetUserConversationByKeyData, GetUserConversationByKeyVariables> ref() {
    GetUserConversationByKeyVariables vars= GetUserConversationByKeyVariables(conversationId: conversationId,userId: userId,);
    return _dataConnect.query("getUserConversationByKey", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class GetUserConversationByKeyUserConversation {
  final String id;
  final String conversationId;
  final String userId;
  final int? unreadCount;
  final Timestamp? lastReadAt;
  final Timestamp? createdAt;
  final GetUserConversationByKeyUserConversationConversation conversation;
  final GetUserConversationByKeyUserConversationUser user;
  GetUserConversationByKeyUserConversation.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  conversationId = nativeFromJson<String>(json['conversationId']),
  userId = nativeFromJson<String>(json['userId']),
  unreadCount = json['unreadCount'] == null ? null : nativeFromJson<int>(json['unreadCount']),
  lastReadAt = json['lastReadAt'] == null ? null : Timestamp.fromJson(json['lastReadAt']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  conversation = GetUserConversationByKeyUserConversationConversation.fromJson(json['conversation']),
  user = GetUserConversationByKeyUserConversationUser.fromJson(json['user']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['conversationId'] = nativeToJson<String>(conversationId);
    json['userId'] = nativeToJson<String>(userId);
    if (unreadCount != null) {
      json['unreadCount'] = nativeToJson<int?>(unreadCount);
    }
    if (lastReadAt != null) {
      json['lastReadAt'] = lastReadAt!.toJson();
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    json['conversation'] = conversation.toJson();
    json['user'] = user.toJson();
    return json;
  }

  GetUserConversationByKeyUserConversation({
    required this.id,
    required this.conversationId,
    required this.userId,
    this.unreadCount,
    this.lastReadAt,
    this.createdAt,
    required this.conversation,
    required this.user,
  });
}

@immutable
class GetUserConversationByKeyUserConversationConversation {
  final String id;
  final String? subject;
  final EnumValue<ConversationStatus>? status;
  final EnumValue<ConversationType>? conversationType;
  final bool? isGroup;
  final String? groupName;
  final String? lastMessage;
  final Timestamp? lastMessageAt;
  final Timestamp? createdAt;
  GetUserConversationByKeyUserConversationConversation.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  subject = json['subject'] == null ? null : nativeFromJson<String>(json['subject']),
  status = json['status'] == null ? null : conversationStatusDeserializer(json['status']),
  conversationType = json['conversationType'] == null ? null : conversationTypeDeserializer(json['conversationType']),
  isGroup = json['isGroup'] == null ? null : nativeFromJson<bool>(json['isGroup']),
  groupName = json['groupName'] == null ? null : nativeFromJson<String>(json['groupName']),
  lastMessage = json['lastMessage'] == null ? null : nativeFromJson<String>(json['lastMessage']),
  lastMessageAt = json['lastMessageAt'] == null ? null : Timestamp.fromJson(json['lastMessageAt']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final GetUserConversationByKeyUserConversationConversation otherTyped = other as GetUserConversationByKeyUserConversationConversation;
    return id == otherTyped.id && 
    subject == otherTyped.subject && 
    status == otherTyped.status && 
    conversationType == otherTyped.conversationType && 
    isGroup == otherTyped.isGroup && 
    groupName == otherTyped.groupName && 
    lastMessage == otherTyped.lastMessage && 
    lastMessageAt == otherTyped.lastMessageAt && 
    createdAt == otherTyped.createdAt;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, subject.hashCode, status.hashCode, conversationType.hashCode, isGroup.hashCode, groupName.hashCode, lastMessage.hashCode, lastMessageAt.hashCode, createdAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if (subject != null) {
      json['subject'] = nativeToJson<String?>(subject);
    }
    if (status != null) {
      json['status'] = 
    conversationStatusSerializer(status!)
    ;
    }
    if (conversationType != null) {
      json['conversationType'] = 
    conversationTypeSerializer(conversationType!)
    ;
    }
    if (isGroup != null) {
      json['isGroup'] = nativeToJson<bool?>(isGroup);
    }
    if (groupName != null) {
      json['groupName'] = nativeToJson<String?>(groupName);
    }
    if (lastMessage != null) {
      json['lastMessage'] = nativeToJson<String?>(lastMessage);
    }
    if (lastMessageAt != null) {
      json['lastMessageAt'] = lastMessageAt!.toJson();
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    return json;
  }

  GetUserConversationByKeyUserConversationConversation({
    required this.id,
    this.subject,
    this.status,
    this.conversationType,
    this.isGroup,
    this.groupName,
    this.lastMessage,
    this.lastMessageAt,
    this.createdAt,
  });
}

@immutable
class GetUserConversationByKeyUserConversationUser {
  final String id;
  final String? fullName;
  final String? photoUrl;
  GetUserConversationByKeyUserConversationUser.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  fullName = json['fullName'] == null ? null : nativeFromJson<String>(json['fullName']),
  photoUrl = 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 GetUserConversationByKeyUserConversationUser otherTyped = other as GetUserConversationByKeyUserConversationUser;
    return id == otherTyped.id && 
    fullName == otherTyped.fullName && 
    photoUrl == otherTyped.photoUrl;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, fullName.hashCode, photoUrl.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if (fullName != null) {
      json['fullName'] = nativeToJson<String?>(fullName);
    }
    if (photoUrl != null) {
      json['photoUrl'] = nativeToJson<String?>(photoUrl);
    }
    return json;
  }

  GetUserConversationByKeyUserConversationUser({
    required this.id,
    this.fullName,
    this.photoUrl,
  });
}

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

    final GetUserConversationByKeyData otherTyped = other as GetUserConversationByKeyData;
    return userConversation == otherTyped.userConversation;
    
  }
  @override
  int get hashCode => userConversation.hashCode;
  

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

  GetUserConversationByKeyData({
    this.userConversation,
  });
}

@immutable
class GetUserConversationByKeyVariables {
  final String conversationId;
  final String userId;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  GetUserConversationByKeyVariables.fromJson(Map<String, 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 GetUserConversationByKeyVariables otherTyped = other as GetUserConversationByKeyVariables;
    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;
  }

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

