/** * Message types for Waku communication */ export enum MessageType { CELL = 'cell', POST = 'post', COMMENT = 'comment', VOTE = 'vote', MODERATE = 'moderate', } /** * Base interface for all message types */ export interface BaseMessage { id: string; type: MessageType; timestamp: number | Date; author: string; signature?: string; // Message signature for verification browserPubKey?: string; // Public key that signed the message } /** * Represents a cell message */ export interface CellMessage extends BaseMessage { type: MessageType.CELL; name: string; description: string; icon?: string; } /** * Represents a post message */ export interface PostMessage extends BaseMessage { type: MessageType.POST; cellId: string; title: string; content: string; } /** * Represents a comment message */ export interface CommentMessage extends BaseMessage { type: MessageType.COMMENT; postId: string; content: string; } /** * Represents a vote message */ export interface VoteMessage extends BaseMessage { type: MessageType.VOTE; targetId: string; // ID of the post or comment being voted on value: 1 | -1; } /** * Represents a moderate message */ export interface ModerateMessage extends BaseMessage { type: MessageType.MODERATE; cellId: string; targetType: 'post' | 'comment' | 'user'; targetId: string; // postId, commentId, or user address (for user moderation) reason?: string; } /** * Cache objects for storing messages */ export interface CellCache { [cellId: string]: CellMessage; } export interface PostCache { [postId: string]: PostMessage; } export interface CommentCache { [commentId: string]: CommentMessage; } export interface VoteCache { [key: string]: VoteMessage; // key = targetId + authorAddress }