import PersistentConnection from '../Services/PersistentConnection';
import BaseStore from './BaseStore';
import Entity, { EntityParams } from './Entity';
export type Extractor = (response: any) => any;
export declare class RealTimeHandler {
    private realTimeConnection;
    constructor(realTimeConnection: PersistentConnection);
    on<EventType>(eventName: string, eventHandler: (event: EventType) => any): void;
    off<EventType>(eventName: string, eventHandler: (event: EventType) => any): void;
}
export default class StoreEntity<T> extends Entity<T> {
    store: BaseStore<T>;
    realTime: RealTimeHandler;
    isAllFetched: boolean;
    protected _onUpdate: ((entity: T) => void)[];
    protected _onCreate: ((entity: T) => void)[];
    protected _onDelete: ((entity: T) => void)[];
    protected _onEvent: {
        [eventType: string]: ((entity: T) => void)[];
    };
    constructor({ session, entityName, routes, routeSuffix }: EntityParams);
    getOrFetch(id: number, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    getAllOrFetch(request?: any, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    create(request: any, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    bulkCreate(request: any, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    delete(id: number): Promise<boolean>;
    update(id: number, request: any, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    fetchAndStore(id: number, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    fetchAllAndStore(request: any, storeExtractor?: Extractor, requestExtractor?: Extractor): Promise<any>;
    storeItem(response: any, storeExtractor?: Extractor): any;
    storeAllItems(response: any, storeExtractor?: Extractor): any;
    private addOrUpdateByItem;
    private extract;
    onCreate: (entity: T) => void;
    registerOnCreate: (fn: (entity: T | T[]) => void) => () => ((entity: T) => void)[];
    onUpdate: (entity: T) => void;
    registerOnUpdate: (fn: (entity: T) => void) => () => ((entity: T) => void)[];
    onDelete: (entity: T) => void;
    registerOnDelete: (fn: (entity: T) => void) => () => ((entity: T) => void)[];
    private onEvent;
    protected registerOnEvent: (eventType: any, fn: (entity: T) => void) => () => ((entity: T) => void)[];
}
