import Foundation
import UIKit

/// Stable callback reference for message cell interactions.
/// Class ref means SwiftUI sees the same pointer on parent re-render,
/// so cells are NOT marked dirty due to closure diffing (memcmp).
@MainActor
final class MessageCellActions {
    var onReply: (ChatMessage) -> Void = { _ in }
    var onForward: (ChatMessage) -> Void = { _ in }
    var onDelete: (ChatMessage) -> Void = { _ in }
    var onCopy: (String) -> Void = { _ in }
    var onImageTap: (String, CGRect, UIView?) -> Void = { _, _, _ in }
    var onScrollToMessage: (String) -> Void = { _ in }
    var onRetry: (ChatMessage) -> Void = { _ in }
    var onRemove: (ChatMessage) -> Void = { _ in }
    var onCall: (String) -> Void = { _ in }  // peer public key
    var onGroupInviteTap: (String) -> Void = { _ in }  // invite string
    var onGroupInviteOpen: (String) -> Void = { _ in }  // group dialog key → navigate
    var onMentionTap: (String, @escaping (Bool) -> Void) -> Void = { _, _ in }  // username (without @), completion(found)
    var onAvatarTap: (String) -> Void = { _ in }       // sender public key (group chats)

    // Multi-select
    var onEnterSelection: (ChatMessage) -> Void = { _ in }
    var onToggleSelection: (String) -> Void = { _ in }  // messageId
}
