part of 'generated.dart';

class FilterConversationsVariablesBuilder {
  Optional<ConversationStatus> _status = Optional.optional((data) => ConversationStatus.values.byName(data), enumSerializer);
  Optional<ConversationType> _conversationType = Optional.optional((data) => ConversationType.values.byName(data), enumSerializer);
  Optional<bool> _isGroup = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _lastMessageAfter = Optional.optional((json) => json['lastMessageAfter'] = Timestamp.fromJson(json['lastMessageAfter']), defaultSerializer);
  Optional<Timestamp> _lastMessageBefore = Optional.optional((json) => json['lastMessageBefore'] = Timestamp.fromJson(json['lastMessageBefore']), defaultSerializer);
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterConversationsVariablesBuilder status(ConversationStatus? t) {
   _status.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder conversationType(ConversationType? t) {
   _conversationType.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder isGroup(bool? t) {
   _isGroup.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder lastMessageAfter(Timestamp? t) {
   _lastMessageAfter.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder lastMessageBefore(Timestamp? t) {
   _lastMessageBefore.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  FilterConversationsVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

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

  QueryRef<FilterConversationsData, FilterConversationsVariables> ref() {
    FilterConversationsVariables vars= FilterConversationsVariables(status: _status,conversationType: _conversationType,isGroup: _isGroup,lastMessageAfter: _lastMessageAfter,lastMessageBefore: _lastMessageBefore,offset: _offset,limit: _limit,);
    return _dataConnect.query("filterConversations", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final FilterConversationsData otherTyped = other as FilterConversationsData;
    return conversations == otherTyped.conversations;
    
  }
  @override
  int get hashCode => conversations.hashCode;
  

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

  FilterConversationsData({
    required this.conversations,
  });
}

@immutable
class FilterConversationsVariables {
  late final Optional<ConversationStatus>status;
  late final Optional<ConversationType>conversationType;
  late final Optional<bool>isGroup;
  late final Optional<Timestamp>lastMessageAfter;
  late final Optional<Timestamp>lastMessageBefore;
  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.')
  FilterConversationsVariables.fromJson(Map<String, dynamic> json) {
  
  
    status = Optional.optional((data) => ConversationStatus.values.byName(data), enumSerializer);
    status.value = json['status'] == null ? null : ConversationStatus.values.byName(json['status']);
  
  
    conversationType = Optional.optional((data) => ConversationType.values.byName(data), enumSerializer);
    conversationType.value = json['conversationType'] == null ? null : ConversationType.values.byName(json['conversationType']);
  
  
    isGroup = Optional.optional(nativeFromJson, nativeToJson);
    isGroup.value = json['isGroup'] == null ? null : nativeFromJson<bool>(json['isGroup']);
  
  
    lastMessageAfter = Optional.optional((json) => json['lastMessageAfter'] = Timestamp.fromJson(json['lastMessageAfter']), defaultSerializer);
    lastMessageAfter.value = json['lastMessageAfter'] == null ? null : Timestamp.fromJson(json['lastMessageAfter']);
  
  
    lastMessageBefore = Optional.optional((json) => json['lastMessageBefore'] = Timestamp.fromJson(json['lastMessageBefore']), defaultSerializer);
    lastMessageBefore.value = json['lastMessageBefore'] == null ? null : Timestamp.fromJson(json['lastMessageBefore']);
  
  
    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 FilterConversationsVariables otherTyped = other as FilterConversationsVariables;
    return status == otherTyped.status && 
    conversationType == otherTyped.conversationType && 
    isGroup == otherTyped.isGroup && 
    lastMessageAfter == otherTyped.lastMessageAfter && 
    lastMessageBefore == otherTyped.lastMessageBefore && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([status.hashCode, conversationType.hashCode, isGroup.hashCode, lastMessageAfter.hashCode, lastMessageBefore.hashCode, offset.hashCode, limit.hashCode]);
  

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

  FilterConversationsVariables({
    required this.status,
    required this.conversationType,
    required this.isGroup,
    required this.lastMessageAfter,
    required this.lastMessageBefore,
    required this.offset,
    required this.limit,
  });
}

