part of 'generated.dart';

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

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

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

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

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

    final ListUnreadUserConversationsByUserIdUserConversations otherTyped = other as ListUnreadUserConversationsByUserIdUserConversations;
    return id == otherTyped.id && 
    conversationId == otherTyped.conversationId && 
    userId == otherTyped.userId && 
    unreadCount == otherTyped.unreadCount && 
    lastReadAt == otherTyped.lastReadAt && 
    createdAt == otherTyped.createdAt && 
    conversation == otherTyped.conversation;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, conversationId.hashCode, userId.hashCode, unreadCount.hashCode, lastReadAt.hashCode, createdAt.hashCode, conversation.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();
    return json;
  }

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

@immutable
class ListUnreadUserConversationsByUserIdUserConversationsConversation {
  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;
  ListUnreadUserConversationsByUserIdUserConversationsConversation.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']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final ListUnreadUserConversationsByUserIdUserConversationsConversation otherTyped = other as ListUnreadUserConversationsByUserIdUserConversationsConversation;
    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;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, subject.hashCode, status.hashCode, conversationType.hashCode, isGroup.hashCode, groupName.hashCode, lastMessage.hashCode, lastMessageAt.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();
    }
    return json;
  }

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

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

    final ListUnreadUserConversationsByUserIdData otherTyped = other as ListUnreadUserConversationsByUserIdData;
    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;
  }

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

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

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

