/** * MessageOperationsService — shared message operation logic for Groups and Channels. * * Encapsulates edit, delete, pin/unpin, and reaction operations with * permission checks. Both GroupService and ChannelService delegate to * this service to avoid duplicating message operation logic. * * Requirements: 9.1, 9.2, 9.3, 9.4, 9.6 */ import { Permission } from '../../enumerations/communication'; import { ICommunicationMessage } from '../../interfaces/communication'; import { PermissionService } from './permissionService'; export declare class MessageNotFoundError extends Error { constructor(messageId: string); } export declare class MessageAuthorError extends Error { constructor(); } export declare class MessagePermissionError extends Error { readonly missingPermission: Permission; constructor(permission: Permission); } export declare class MessageReactionNotFoundError extends Error { constructor(reactionId: string); } /** * Context that holds a pinnedMessageIds list (both IGroup and IChannel). */ export interface IPinnableContext { pinnedMessageIds: string[]; } /** * Shared message operations for edit, delete, pin, and reaction logic. * Callers are responsible for membership/existence checks on the context * (group or channel) before invoking these methods. */ export declare class MessageOperationsService { private readonly permissionService; constructor(permissionService: PermissionService); /** * Edit a message authored by the requesting member. * Preserves previous content in editHistory. * * Requirement 9.1: update content, preserve edit history, set editedAt. */ editMessage(messages: ICommunicationMessage[], messageId: string, memberId: string, newContent: string, messageNotFoundFactory: (id: string) => Error, authorErrorFactory: () => Error): ICommunicationMessage; /** * Delete a message. Authors can delete their own; moderators/admins * need DELETE_ANY_MESSAGE permission. * * Requirements 9.2, 9.3: mark as deleted, set deletedBy. */ deleteMessage(messages: ICommunicationMessage[], contextId: string, messageId: string, memberId: string, messageNotFoundFactory: (id: string) => Error, permissionErrorFactory: (p: Permission) => Error): void; /** * Pin a message. Requires PIN_MESSAGES permission. * Adds the message ID to the context's pinnedMessageIds list. * * Requirement 9.3: add to pinned messages list. */ pinMessage(messages: ICommunicationMessage[], contextId: string, messageId: string, memberId: string, context: IPinnableContext, messageNotFoundFactory: (id: string) => Error, permissionErrorFactory: (p: Permission) => Error): void; /** * Unpin a message. Requires PIN_MESSAGES permission. * Removes the message ID from the context's pinnedMessageIds list. * * Requirement 9.3: remove from pinned messages list. */ unpinMessage(messages: ICommunicationMessage[], contextId: string, messageId: string, memberId: string, context: IPinnableContext, messageNotFoundFactory: (id: string) => Error, permissionErrorFactory: (p: Permission) => Error): void; /** * Add a reaction to a message. * * Requirement 9.4: add reaction with emoji and member tracking. */ addReaction(messages: ICommunicationMessage[], messageId: string, memberId: string, emoji: string, messageNotFoundFactory: (id: string) => Error): string; /** * Remove a reaction from a message. * * Requirement 9.4: remove reaction from message. */ removeReaction(messages: ICommunicationMessage[], messageId: string, reactionId: string, messageNotFoundFactory: (id: string) => Error, reactionNotFoundFactory: (id: string) => Error): void; } //# sourceMappingURL=messageOperationsService.d.ts.map