// ── Chat Message Types ── export interface ChatMessage { id: number; userId: number; walletAddress: string; username: string; avatar: string | null; message: string; replyTo: { id: number; message: string; username: string; walletAddress: string; } | null; timestamp: string; edited: boolean; editedAt: string | null; isWinnerAnnouncement: boolean; winAmount?: number; roundId?: number; gameInvite: Record | null; pnlShare: Record | null; gifUrl: string | null; reactions: Record; mentions: ChatMention[]; payment: ChatPayment | null; } export interface ChatMention { userId: number; username: string; walletAddress: string; } export interface ChatPayment { id: number; senderUsername: string; recipientUsername: string; amount: number; signature: string; status: string; errorMessage: string | null; createdAt: string; confirmedAt: string | null; } // ── DM Types ── export interface DirectMessage { id: number; senderId: number; recipientId?: number; senderUsername: string; senderAvatar: string | null; senderWallet: string; message: string; read: boolean; createdAt: string; isOwn: boolean; gameInvite: Record | null; } export interface Conversation { otherUserId: number; otherUsername: string; otherAvatar: string | null; otherWallet: string; lastMessage: string; lastMessageAt: string; unreadCount: number; } // ── Social Types ── export interface FriendUser { userId: number; username: string; avatar: string | null; walletAddress: string; friendsSince?: string; isFriend?: boolean; isBlocked?: boolean; friendRequestSent?: boolean; friendRequestReceived?: boolean; friendRequestId?: number; } export interface FriendRequest { id: number; fromUserId: number; fromUsername: string; fromAvatar: string | null; fromWallet: string; createdAt: string; } /** A friend request the current user has SENT (still pending). */ export interface SentFriendRequest { id: number; toUserId: number; toUsername: string; toAvatar: string | null; toWallet: string; createdAt: string; } // ── Online / Real-time Types ── export interface OnlineUser { walletAddress: string; username: string; avatar: string | null; } export interface TypingEvent { userId: number; username: string; walletAddress: string; isTyping: boolean; } export interface ChatNotification { id: number; type: string; read: boolean; message: string; messageId?: number; senderUsername: string; senderWallet: string; senderAvatar: string | null; createdAt: string; [key: string]: unknown; } // ── Connection State ── export type ChatConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error'; // ── Params ── export interface SendMessageParams { message: string; replyToId?: number; mentions?: number[]; gifUrl?: string; gameInvite?: Record; pnlShare?: Record; } export interface SendDMParams { recipientWallet: string; message: string; gameInvite?: Record; animation?: string; }