import { DocumentSnapshot, Unsubscribe } from 'firebase/firestore'; import { IMessage } from '../types'; export declare const COLLECTIONS: { readonly CONVERSATIONS: "conversations"; readonly MESSAGES: "messages"; readonly USERS: "users"; }; /** * Chat service compatible with RN-Firebase-Chat implementation * Following the documentation specifications */ export declare class ChatService { static instance: ChatService; private db; private storage; private userService; constructor(); static getInstance(): ChatService; createConversation(memberIds: string[], initiatorId: string, type?: 'private' | 'group', name?: string, otherName?: string, conversationId?: string): Promise; /** * Check if a conversation exists in Firestore * @param conversationId - The ID of the conversation to check * @returns Promise - True if conversation exists, false otherwise */ private conversationExists; /** * Send a message to a conversation. Creates the conversation if it doesn't exist. * @param conversationId - The ID of the conversation * @param message - The message to send (without id and createdAt) * @param conversationOptions - Optional parameters for conversation creation if it doesn't exist * @returns Promise */ sendMessage(conversationId: string, message: Omit, conversationOptions?: { memberIds?: string[]; type?: 'private' | 'group'; name?: string; otherName?: string; }): Promise; subscribeToMessages(conversationId: string, callback: (messages: IMessage[], lastDoc?: DocumentSnapshot) => void, limitCount?: number): () => void; /** * Get user's conversations from the user's conversations subcollection * @param userId - The ID of the user * @param callback - Callback function to receive conversations * @returns Unsubscribe function */ subscribeToUserConversations(userId: string, callback: (userConversations: any[]) => void): () => void; updateTypingStatus(conversationId: string, userId: string, isTyping: boolean): Promise; subscribeToTypingStatus(conversationId: string, callback: (typingUsers: Record) => void): Unsubscribe; updateUnread(conversationId: string, userId: string): Promise; uploadFile(file: File, conversationId: string): Promise<{ path: string; downloadURL: string; }>; deleteMessage(conversationId: string, messageId: string): Promise; getMessagesWithPagination(conversationId: string, limitCount?: number, latestMessageDoc?: DocumentSnapshot): Promise; }