import { Observable } from 'rxjs/internal/Observable';
import { Subject } from 'rxjs/internal/Subject';
export declare enum Actions {
    CREATE = "CREATE",
    UPDATE = "UPDATE",
    REMOVE = "REMOVE",
    CLEAR = "CLEAR"
}
export type Action = {
    type: Actions;
    payload: any;
};
export interface BaseId {
    id?: number;
}
export interface CalculationInfo<T> {
    onUpdate?: (value: any, item: T) => void;
    onCreate?: (value: any, item: T) => void;
    onDelete?: (value: any, item: T) => void;
    value: any;
    errors?: CalculationError[];
    uuid?: string;
}
export interface CalculationError {
    type: Actions;
    error: any;
}
export declare const ActionToFunction: {
    CREATE: string;
    REMOVE: string;
    UPDATE: string;
};
export declare const THROTTLE_TIME = 1000;
/**
 * @property {boolean} realTime.addItemsWhenHandlingUpdate - controls if Realtime On Update Handler
 *  will store an item if it is missing in the store.
 *  True by default. Might cause unwanted storing of partial data.
 */
export type BaseStoreConfig = {
    realTime: {
        addItemsWhenHandlingUpdate: boolean;
    };
};
export default class BaseStore<T extends BaseId> {
    state$: Observable<Map<number, T>>;
    protected items$: Subject<Action>;
    protected onItemUpdateEvents: ((item: T) => void)[];
    protected onItemCreatedEvents: ((item: T) => void)[];
    protected onItemRemovedEvents: ((itemId: number, item?: T) => void)[];
    protected onListUpdateEvents: ((items: T[]) => void)[];
    private config;
    private calculations;
    private _items;
    constructor(config?: Partial<BaseStoreConfig>);
    addCalculation: (calculationInfo: CalculationInfo<T>) => string;
    removeCalculation: (uuid: string) => void;
    getCalculationValue: (uuid: string) => any;
    handleCalculations: (item: T, type: Actions) => Promise<void>;
    onItemCreated: (fn: (item: T) => void) => () => ((item: T) => void)[];
    onItemUpdate: (fn: (item: T) => void) => () => ((item: T) => void)[];
    onItemRemoved: (fn: (itemId: number, item?: T) => void) => () => ((itemId: number, item?: T) => void)[];
    onListUpdate: (fn: (item: T[]) => void) => () => ((items: T[]) => void)[];
    unsubscribe: () => void;
    handleStateUpdate: (currentState: Map<number, T>, action: Action) => Map<number, T>;
    addToStore(item: T): void;
    updateInStore(item: T): void;
    removeFromStore(itemId: number): void;
    clearStore(): void;
    getItem: (itemId: any) => T;
    getItems: () => T[];
    getItemsByIds: (ids: number[]) => T[];
    getItemsMap: () => Map<number, T>;
    addItems(items: T[]): void;
    private _addToStore;
    private _updateInStore;
    private _removeFromStore;
    private _clearStore;
}
