export function setupSocket(io) {
    io.on("connection", (socket) => {
        socket.on("join-campaign", (campaignId) => {
            socket.join(`campaign:${campaignId}`);
        });
        socket.on("leave-campaign", (campaignId) => {
            socket.leave(`campaign:${campaignId}`);
        });
        socket.on("disconnect", () => {
            // Rooms are cleaned up automatically by Socket.IO
        });
    });
}
export function broadcastToCampaign(io, campaignId, event, data) {
    io.to(`campaign:${campaignId}`).emit(event, data);
}
