import { InboxMessage } from '@trycourier/courier-js';
import { InboxDataSet } from '../types/inbox-data-set';
import { CourierInboxDataStoreListener } from './datastore-listener';
import { CourierInboxFeedType } from '../types/feed-type';
export declare class CourierInboxDatastore {
    private static instance;
    private _inboxDataSet?;
    private _archiveDataSet?;
    private _dataStoreListeners;
    private _unreadCount?;
    private isPaginatingInbox;
    private isPaginatingArchive;
    static get shared(): CourierInboxDatastore;
    get unreadCount(): number;
    get inboxDataSet(): InboxDataSet;
    get archiveDataSet(): InboxDataSet;
    addDataStoreListener(listener: CourierInboxDataStoreListener): void;
    removeDataStoreListener(listener: CourierInboxDataStoreListener): void;
    private fetchCachableDataSet;
    private fetchUnreadCount;
    load(props?: {
        canUseCache: boolean;
    }): Promise<void>;
    listenForUpdates(): Promise<void>;
    private connectSocket;
    /**
     * Get a message by messageId from the inbox or archive data set
     * @param props - The message ID
     * @returns The message or undefined if it is not found
     */
    private getMessage;
    /**
     * Fetch the next page of messages
     * @param props - The feed type
     * @returns The next page of messages or null if there is no next page
     */
    fetchNextPageOfMessages(props: {
        feedType: CourierInboxFeedType;
    }): Promise<InboxDataSet | null>;
    /**
     * Check if the datastore is loaded and ready to perform mutations
     * @returns True if the datastore is loaded and ready to perform mutations, false otherwise
     */
    private canMutate;
    readMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    unreadMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    openMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    clickMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    archiveMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    unarchiveMessage({ message, canCallApi }: {
        message: InboxMessage;
        canCallApi?: boolean;
    }): Promise<void>;
    archiveReadMessages({ canCallApi }?: {
        canCallApi?: boolean;
    }): Promise<void>;
    archiveAllMessages({ canCallApi }?: {
        canCallApi?: boolean;
    }): Promise<void>;
    readAllMessages({ canCallApi }?: {
        canCallApi?: boolean;
    }): Promise<void>;
    /**
     * Find the insert index for a new message in a data set
     * @param newMessage - The new message to insert
     * @param dataSet - The data set to insert the message into
     * @returns The index to insert the message at
     */
    private findInsertIndex;
    private addPage;
    private addMessage;
    private removeMessage;
    /**
     * Apply a message snapshot to the data store
     * @param snapshot - The message snapshot to apply
     */
    private applyMessageSnapshot;
    private applyDatastoreSnapshot;
    /**
     * Update a message in the data store
     * @param message - The message to update
     * @param index - The index of the message in its respective data set
     * @param feedType - The feed type of the message
     */
    private updateMessage;
    /**
     * Copy an inbox data set
     * @param dataSet - The inbox data set to copy
     * @returns A copy of the inbox data set
     */
    private getDatastoreSnapshot;
    /**
     * Copy an inbox message with its archive and inbox indices
     * @param message - The inbox message to copy
     * @returns A copy of the inbox message with its archive and inbox indices
     */
    private getMessageSnapshot;
}
