part of 'generated.dart';

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

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

  ListConversationsByStatusVariablesBuilder(this._dataConnect, {required  this.status,});
  Deserializer<ListConversationsByStatusData> dataDeserializer = (dynamic json)  => ListConversationsByStatusData.fromJson(jsonDecode(json));
  Serializer<ListConversationsByStatusVariables> varsSerializer = (ListConversationsByStatusVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListConversationsByStatusData, ListConversationsByStatusVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListConversationsByStatusData, ListConversationsByStatusVariables> ref() {
    ListConversationsByStatusVariables vars= ListConversationsByStatusVariables(status: status,offset: _offset,limit: _limit,);
    return _dataConnect.query("listConversationsByStatus", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

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

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

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

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

  ListConversationsByStatusVariables({
    required this.status,
    required this.offset,
    required this.limit,
  });
}

