part of 'generated.dart';

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

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

  ListUserConversationsByConversationIdVariablesBuilder(this._dataConnect, {required  this.conversationId,});
  Deserializer<ListUserConversationsByConversationIdData> dataDeserializer = (dynamic json)  => ListUserConversationsByConversationIdData.fromJson(jsonDecode(json));
  Serializer<ListUserConversationsByConversationIdVariables> varsSerializer = (ListUserConversationsByConversationIdVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<ListUserConversationsByConversationIdData, ListUserConversationsByConversationIdVariables>> execute() {
    return ref().execute();
  }

  QueryRef<ListUserConversationsByConversationIdData, ListUserConversationsByConversationIdVariables> ref() {
    ListUserConversationsByConversationIdVariables vars= ListUserConversationsByConversationIdVariables(conversationId: conversationId,offset: _offset,limit: _limit,);
    return _dataConnect.query("listUserConversationsByConversationId", dataDeserializer, varsSerializer, vars);
  }
}

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

    final ListUserConversationsByConversationIdUserConversations otherTyped = other as ListUserConversationsByConversationIdUserConversations;
    return id == otherTyped.id && 
    conversationId == otherTyped.conversationId && 
    userId == otherTyped.userId && 
    unreadCount == otherTyped.unreadCount && 
    lastReadAt == otherTyped.lastReadAt && 
    createdAt == otherTyped.createdAt && 
    user == otherTyped.user;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, conversationId.hashCode, userId.hashCode, unreadCount.hashCode, lastReadAt.hashCode, createdAt.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['user'] = user.toJson();
    return json;
  }

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

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

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

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

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

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

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

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

  ListUserConversationsByConversationIdVariables({
    required this.conversationId,
    required this.offset,
    required this.limit,
  });
}

