part of 'generated.dart';

class FilterUserConversationsVariablesBuilder {
  Optional<String> _userId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _conversationId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _unreadMin = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _unreadMax = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _lastReadAfter = Optional.optional((json) => json['lastReadAfter'] = Timestamp.fromJson(json['lastReadAfter']), defaultSerializer);
  Optional<Timestamp> _lastReadBefore = Optional.optional((json) => json['lastReadBefore'] = Timestamp.fromJson(json['lastReadBefore']), defaultSerializer);
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterUserConversationsVariablesBuilder userId(String? t) {
   _userId.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder conversationId(String? t) {
   _conversationId.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder unreadMin(int? t) {
   _unreadMin.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder unreadMax(int? t) {
   _unreadMax.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder lastReadAfter(Timestamp? t) {
   _lastReadAfter.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder lastReadBefore(Timestamp? t) {
   _lastReadBefore.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  FilterUserConversationsVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

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

  QueryRef<FilterUserConversationsData, FilterUserConversationsVariables> ref() {
    FilterUserConversationsVariables vars= FilterUserConversationsVariables(userId: _userId,conversationId: _conversationId,unreadMin: _unreadMin,unreadMax: _unreadMax,lastReadAfter: _lastReadAfter,lastReadBefore: _lastReadBefore,offset: _offset,limit: _limit,);
    return _dataConnect.query("filterUserConversations", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

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

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

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

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

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

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

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

@immutable
class FilterUserConversationsVariables {
  late final Optional<String>userId;
  late final Optional<String>conversationId;
  late final Optional<int>unreadMin;
  late final Optional<int>unreadMax;
  late final Optional<Timestamp>lastReadAfter;
  late final Optional<Timestamp>lastReadBefore;
  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.')
  FilterUserConversationsVariables.fromJson(Map<String, dynamic> json) {
  
  
    userId = Optional.optional(nativeFromJson, nativeToJson);
    userId.value = json['userId'] == null ? null : nativeFromJson<String>(json['userId']);
  
  
    conversationId = Optional.optional(nativeFromJson, nativeToJson);
    conversationId.value = json['conversationId'] == null ? null : nativeFromJson<String>(json['conversationId']);
  
  
    unreadMin = Optional.optional(nativeFromJson, nativeToJson);
    unreadMin.value = json['unreadMin'] == null ? null : nativeFromJson<int>(json['unreadMin']);
  
  
    unreadMax = Optional.optional(nativeFromJson, nativeToJson);
    unreadMax.value = json['unreadMax'] == null ? null : nativeFromJson<int>(json['unreadMax']);
  
  
    lastReadAfter = Optional.optional((json) => json['lastReadAfter'] = Timestamp.fromJson(json['lastReadAfter']), defaultSerializer);
    lastReadAfter.value = json['lastReadAfter'] == null ? null : Timestamp.fromJson(json['lastReadAfter']);
  
  
    lastReadBefore = Optional.optional((json) => json['lastReadBefore'] = Timestamp.fromJson(json['lastReadBefore']), defaultSerializer);
    lastReadBefore.value = json['lastReadBefore'] == null ? null : Timestamp.fromJson(json['lastReadBefore']);
  
  
    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 FilterUserConversationsVariables otherTyped = other as FilterUserConversationsVariables;
    return userId == otherTyped.userId && 
    conversationId == otherTyped.conversationId && 
    unreadMin == otherTyped.unreadMin && 
    unreadMax == otherTyped.unreadMax && 
    lastReadAfter == otherTyped.lastReadAfter && 
    lastReadBefore == otherTyped.lastReadBefore && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([userId.hashCode, conversationId.hashCode, unreadMin.hashCode, unreadMax.hashCode, lastReadAfter.hashCode, lastReadBefore.hashCode, offset.hashCode, limit.hashCode]);
  

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

  FilterUserConversationsVariables({
    required this.userId,
    required this.conversationId,
    required this.unreadMin,
    required this.unreadMax,
    required this.lastReadAfter,
    required this.lastReadBefore,
    required this.offset,
    required this.limit,
  });
}

