part of 'generated.dart';

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

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

  ListConversationsByTypeVariablesBuilder(this._dataConnect, {required  this.conversationType,});
  Deserializer<ListConversationsByTypeData> dataDeserializer = (dynamic json)  => ListConversationsByTypeData.fromJson(jsonDecode(json));
  Serializer<ListConversationsByTypeVariables> varsSerializer = (ListConversationsByTypeVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListConversationsByTypeData, ListConversationsByTypeVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListConversationsByTypeData, ListConversationsByTypeVariables> ref() {
    ListConversationsByTypeVariables vars= ListConversationsByTypeVariables(conversationType: conversationType,offset: _offset,limit: _limit,);
    return _dataConnect.query("listConversationsByType", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

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

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

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

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

  ListConversationsByTypeVariables({
    required this.conversationType,
    required this.offset,
    required this.limit,
  });
}

