import { PayloadAction, type Slice } from '@reduxjs/toolkit';
import type { WritableDraft } from 'immer';
import { EditAction, HistoryPreloadState, IMessage, IRoom } from '../types/types';
import type XmppClient from '../networking/xmppClient';
export interface RoomPreloadPatch {
    jid: string;
    messages?: IMessage[];
    historyPreloadState?: HistoryPreloadState;
    unreadCapped?: boolean;
    historyComplete?: boolean;
}
export interface RoomMessagesState {
    rooms: {
        [jid: string]: IRoom;
    };
    activeRoomJID: string | null;
    editAction?: EditAction;
    isLoading: boolean;
    loadingText?: string;
    usersSet?: Record<string, any>;
    pendingNotificationJid?: string | null;
}
export declare const addRoomViaApi: import("@reduxjs/toolkit").AsyncThunk<void, {
    room: IRoom;
    xmpp: XmppClient;
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
declare const reducers: {
    addRoom(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomData: IRoom;
    }>): void;
    deleteRoom(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        jid: string;
    }>): void;
    updateRoom(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        jid: string;
        updates: Partial<IRoom>;
    }>): void;
    setRoomMessages(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string;
        messages: IMessage[];
    }>): void;
    deleteRoomMessage(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string;
        messageId: string;
    }>): void;
    setEditAction: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<EditAction | undefined>) => void;
    editRoomMessage(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string;
        messageId: string;
        text: string;
    }>): void;
    addRoomMessage(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string;
        message: IMessage;
        start?: boolean;
    }>): void;
    deleteAllRooms(state: WritableDraft<RoomMessagesState>): void;
    setComposing(state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        chatJID: string;
        composing: boolean;
        composingList?: string[];
    }>): void;
    setIsLoading: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        chatJID?: string;
        loading: boolean;
        loadingText?: string;
    }>) => void;
    setLastViewedTimestamp: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        chatJID: string;
        timestamp: number;
    }>) => void;
    setRoomRole: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        chatJID: string;
        role: string;
    }>) => void;
    setRoomNoMessages: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        value: boolean;
        chatJID?: string;
    }>) => void;
    setCurrentRoom: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string | null;
    }>) => void;
    /**
     * Stash a JID that a push notification asked us to open before
     * the rooms list has loaded. The Chat component clears this once
     * the room exists locally and dispatches `setCurrentRoom`.
     */
    setPendingNotificationJid: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<string | null>) => void;
    clearPendingNotificationJid: (state: WritableDraft<RoomMessagesState>) => void;
    /**
     * Stamp a message in `state.rooms[roomJID].messages` with an updated
     * reactions list. The reactionsMiddleware listens for this action to
     * keep `IRoom.lastMessage` / `lastMessageTimestamp` in sync.
     */
    setReactions: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        roomJID: string;
        messageId: string;
        from?: string;
        reactions: string[];
        latestReactionTimestamp?: string;
        data?: Record<string, string>;
    }>) => void;
    setLogoutState: (state: WritableDraft<RoomMessagesState>) => void;
    setActiveMessage: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        id: string;
        chatJID: string;
    }>) => void;
    setCloseActiveMessage: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        chatJID: string;
    }>) => void;
    /**
     * Batched update used by the history preload scheduler. Each patch is
     * applied to its room: messages REPLACE (when provided), state fields
     * MERGE. Rooms that don't exist yet are ignored.
     */
    addRoomFromApi: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        room: IRoom;
    }>) => void;
    applyRoomsPreloadBatch: (state: WritableDraft<RoomMessagesState>, action: PayloadAction<{
        rooms: RoomPreloadPatch[];
    }>) => void;
};
export declare const roomsStore: Slice<RoomMessagesState, typeof reducers, 'roomMessages'>;
export declare const msgSortableMs: (msg: any) => number;
export declare const addRoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomData: IRoom;
}, "roomMessages/addRoom">, deleteAllRooms: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"roomMessages/deleteAllRooms">, setRoomMessages: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string;
    messages: IMessage[];
}, "roomMessages/setRoomMessages">, addRoomMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string;
    message: IMessage;
    start?: boolean;
}, "roomMessages/addRoomMessage">, deleteRoomMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string;
    messageId: string;
}, "roomMessages/deleteRoomMessage">, setEditAction: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<EditAction | undefined, "roomMessages/setEditAction">, editRoomMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string;
    messageId: string;
    text: string;
}, "roomMessages/editRoomMessage">, setComposing: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    chatJID: string;
    composing: boolean;
    composingList?: string[];
}, "roomMessages/setComposing">, setIsLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    chatJID?: string;
    loading: boolean;
    loadingText?: string;
}, "roomMessages/setIsLoading">, setLastViewedTimestamp: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    chatJID: string;
    timestamp: number;
}, "roomMessages/setLastViewedTimestamp">, setRoomNoMessages: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    value: boolean;
    chatJID?: string;
}, "roomMessages/setRoomNoMessages">, setCurrentRoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string | null;
}, "roomMessages/setCurrentRoom">, setRoomRole: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    chatJID: string;
    role: string;
}, "roomMessages/setRoomRole">, setLogoutState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"roomMessages/setLogoutState">, setActiveMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    id: string;
    chatJID: string;
}, "roomMessages/setActiveMessage">, setCloseActiveMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    chatJID: string;
}, "roomMessages/setCloseActiveMessage">, deleteRoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    jid: string;
}, "roomMessages/deleteRoom">, updateRoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    jid: string;
    updates: Partial<IRoom>;
}, "roomMessages/updateRoom">, applyRoomsPreloadBatch: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    rooms: RoomPreloadPatch[];
}, "roomMessages/applyRoomsPreloadBatch">, setPendingNotificationJid: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "roomMessages/setPendingNotificationJid">, clearPendingNotificationJid: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"roomMessages/clearPendingNotificationJid">, setReactions: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
    roomJID: string;
    messageId: string;
    from?: string;
    reactions: string[];
    latestReactionTimestamp?: string;
    data?: Record<string, string>;
}, "roomMessages/setReactions">;
declare const _default: import("redux").Reducer<RoomMessagesState>;
export default _default;
//# sourceMappingURL=roomsSlice.d.ts.map