part of 'generated.dart';

class ListUserConversationsByUserIdVariablesBuilder {
  String userId;
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  ListUserConversationsByUserIdVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  ListUserConversationsByUserIdVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

  ListUserConversationsByUserIdVariablesBuilder(this._dataConnect, {required  this.userId,});
  Deserializer<ListUserConversationsByUserIdData> dataDeserializer = (dynamic json)  => ListUserConversationsByUserIdData.fromJson(jsonDecode(json));
  Serializer<ListUserConversationsByUserIdVariables> varsSerializer = (ListUserConversationsByUserIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListUserConversationsByUserIdData, ListUserConversationsByUserIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListUserConversationsByUserIdData, ListUserConversationsByUserIdVariables> ref() {
    ListUserConversationsByUserIdVariables vars= ListUserConversationsByUserIdVariables(userId: userId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listUserConversationsByUserId", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class ListUserConversationsByUserIdUserConversations {
  final String id;
  final String conversationId;
  final String userId;
  final int? unreadCount;
  final Timestamp? lastReadAt;
  final Timestamp? createdAt;
  final Timestamp? updatedAt;
  final String? createdBy;
  final ListUserConversationsByUserIdUserConversationsConversation conversation;
  final ListUserConversationsByUserIdUserConversationsUser user;
  ListUserConversationsByUserIdUserConversations.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']),
  updatedAt = json['updatedAt'] == null ? null : Timestamp.fromJson(json['updatedAt']),
  createdBy = json['createdBy'] == null ? null : nativeFromJson<String>(json['createdBy']),
  conversation = ListUserConversationsByUserIdUserConversationsConversation.fromJson(json['conversation']),
  user = ListUserConversationsByUserIdUserConversationsUser.fromJson(json['user']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListUserConversationsByUserIdUserConversations otherTyped = other as ListUserConversationsByUserIdUserConversations;
    return id == otherTyped.id && 
    conversationId == otherTyped.conversationId && 
    userId == otherTyped.userId && 
    unreadCount == otherTyped.unreadCount && 
    lastReadAt == otherTyped.lastReadAt && 
    createdAt == otherTyped.createdAt && 
    updatedAt == otherTyped.updatedAt && 
    createdBy == otherTyped.createdBy && 
    conversation == otherTyped.conversation && 
    user == otherTyped.user;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, conversationId.hashCode, userId.hashCode, unreadCount.hashCode, lastReadAt.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.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();
    }
    if (updatedAt != null) {
      json['updatedAt'] = updatedAt!.toJson();
    }
    if (createdBy != null) {
      json['createdBy'] = nativeToJson<String?>(createdBy);
    }
    json['conversation'] = conversation.toJson();
    json['user'] = user.toJson();
    return json;
  }

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

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

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

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

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

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

    final ListUserConversationsByUserIdData otherTyped = other as ListUserConversationsByUserIdData;
    return userConversations == otherTyped.userConversations;
    
  }
  @override
  int get hashCode => userConversations.hashCode;
  

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

  ListUserConversationsByUserIdData({
    required this.userConversations,
  });
}

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

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

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

  ListUserConversationsByUserIdVariables({
    required this.userId,
    required this.offset,
    required this.limit,
  });
}

