part of 'generated.dart';

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

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

  ListUserConversationsVariablesBuilder(this._dataConnect, );
  Deserializer<ListUserConversationsData> dataDeserializer = (dynamic json)  => ListUserConversationsData.fromJson(jsonDecode(json));
  Serializer<ListUserConversationsVariables> varsSerializer = (ListUserConversationsVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListUserConversationsData, ListUserConversationsVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListUserConversationsData, ListUserConversationsVariables> ref() {
    ListUserConversationsVariables vars= ListUserConversationsVariables(offset: _offset,limit: _limit,);
    return _dataConnect.query("listUserConversations", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

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

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

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

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

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

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

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

@immutable
class ListUserConversationsVariables {
  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.')
  ListUserConversationsVariables.fromJson(Map<String, dynamic> json) {
  
  
    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 ListUserConversationsVariables otherTyped = other as ListUserConversationsVariables;
    return offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([offset.hashCode, limit.hashCode]);
  

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

  ListUserConversationsVariables({
    required this.offset,
    required this.limit,
  });
}

