import { AdapterData, ChildModelOf, Event, EventEmitter, EventListener, FullModelOf, InitModelOf, ModelAdapterEventMap, ModelAdapterModel, Predicate, PropertyChangeEvent, PropertyChangeEventFilter, RemoteEvent, Session, SomeRequired, Widget, WidgetEventTypeFilter, WidgetModel } from '../index';
/**
 * A model adapter is the connector with the server, it takes the events sent from the server and calls the corresponding methods on the widget.
 * It also sends events to the server whenever an action happens on the widget.
 */
export declare class ModelAdapter extends EventEmitter implements ModelAdapterModel, ModelAdapterLike {
    model: ModelAdapterModel;
    initModel: SomeRequired<this['model'], 'session' | 'id'>;
    eventMap: ModelAdapterEventMap;
    self: ModelAdapter;
    id: string;
    objectType: string;
    initialized: boolean;
    attached: boolean;
    destroyed: boolean;
    widget: Widget;
    session: Session;
    protected _enabledBeforeOffline: boolean;
    /**
     * Widget properties which should be sent to server on property change.
     */
    protected _remoteProperties: string[];
    /**
     * Properties that need to be synced in a specific order.
     */
    protected _orderedProperties: string[];
    protected _widgetListener: EventListener;
    protected _propertyChangeEventFilter: PropertyChangeEventFilter;
    protected _widgetEventTypeFilter: WidgetEventTypeFilter;
    constructor();
    init(model: InitModelOf<this>): void;
    protected _init(model: InitModelOf<this>): void;
    destroy(): void;
    createWidget<T extends Widget>(adapterData: ChildModelOf<Widget>, parent: Widget): T;
    /**
     * Override this method to do something right after the widget has been created and has been
     * attached to the remote adapter. The default impl. does nothing.
     */
    /** @internal */
    _postCreateWidget(): void;
    protected _initModel(m: ChildModelOf<Widget>, parent: Widget): FullModelOf<Widget>;
    /**
     * Override this method to call _sync* methods of the ModelAdapter _before_ the widget is created.
     */
    protected _initProperties(model: WidgetModel): void;
    /**
     * @returns A new widget instance. The default impl. uses calls scout.create() with property objectType from given model.
     */
    protected _createWidget(model: FullModelOf<Widget>): Widget;
    /** @internal */
    _attachWidget(): void;
    protected _detachWidget(): void;
    goOffline(): void;
    protected _goOffline(): void;
    goOnline(): void;
    protected _goOnline(): void;
    isRemoteProperty(propertyName: string): boolean;
    protected _addRemoteProperties(properties: string[] | string): void;
    protected _removeRemoteProperties(properties: string[] | string): void;
    protected _addOrderedProperties(properties: string[] | string): void;
    protected _addProperties(propertyName: string, properties: string[] | string): void;
    protected _removeProperties(propertyName: string, properties: string[] | string): void;
    /**
     * Creates an Event object from the current adapter instance and sends the event by using the Session#sendEvent() method.
     * Local objects may set a different remoteHandler to call custom code instead of the Session#sendEvent() method.
     *
     * @param type of event
     * @param data of event
     */
    protected _send<Data extends Record<PropertyKey, any>>(type: string, data?: Data, options?: ModelAdapterSendOptions<Data>): void;
    /**
     * Sends the given value as property event to the server.
     */
    protected _sendProperty(propertyName: string, value: any): void;
    /**
     * Adds a custom filter for events.
     */
    addFilterForWidgetEvent(filter: Predicate<Event>): void;
    /**
     * Adds a filter which only checks the type of the event.
     */
    addFilterForWidgetEventType(eventType: string): void;
    /**
     * Adds a filter which checks the name and value of every property in the given properties.
     */
    addFilterForProperties(properties: Record<string, any>): void;
    /**
     * Adds a filter which only checks the property name and ignores the value.
     */
    addFilterForPropertyName(propertyName: string): void;
    protected _isPropertyChangeEventFiltered(propertyName: string, value: any): boolean;
    protected _isWidgetEventFiltered(event: Event<Widget>): boolean;
    resetEventFilters(): void;
    protected _onWidgetPropertyChange(event: PropertyChangeEvent<any, Widget>): void;
    protected _prepareRemoteProperty(propertyName: string, value: any): any;
    protected _callSendProperty(propertyName: string, value: any): void;
    protected _onWidgetDestroy(event: Event<Widget>): void;
    /**
     * Do not override this method. Widget event filtering is done here, before _onWidgetEvent is called.
     */
    protected _onWidgetEventInternal(event: Event<Widget>): void;
    protected _onWidgetEvent(event: Event<Widget>): void;
    protected _syncPropertiesOnPropertyChange(newProperties: Record<string, any>): void;
    /**
     * Orders the properties based on {@link _orderedProperties}.
     *
     * @returns the ordered property names.
     */
    protected _orderPropertyNamesOnSync(newProperties: Record<string, any>): string[];
    protected _createPropertySortFunc(order: string[]): (a: string, b: string) => number;
    /**
     * Called by {@link Session} for every event from the model
     */
    onModelEvent(event: RemoteEvent): void;
    /**
     * Processes the JSON event from the server and calls the corresponding setter of the widget for each property.
     */
    onModelPropertyChange(event: RemoteEvent): void;
    onModelAction(event: RemoteEvent): void;
    toString(): string;
    /**
     * This method is used to modify adapterData before the data is exported (as used for JSON export).
     */
    exportAdapterData(adapterData: AdapterData): AdapterData;
    /**
     * Static method to modify the prototype of Widget.
     */
    static modifyWidgetPrototype(event: Event): void;
}
export interface ModelAdapterLike {
    widget: Widget;
    onModelEvent(event: RemoteEvent): void;
    resetEventFilters(): void;
    destroy(): void;
    exportAdapterData(adapterData: AdapterData): AdapterData;
}
export interface ModelAdapterSendOptions<Data> {
    /**
     * Delay in milliseconds before the event is sent. Default is 0.
     */
    delay?: number;
    /**
     * Coalesce function added to event-object. Default: none.
     */
    coalesce?(this: RemoteEvent & Data, event: RemoteEvent & Data): boolean;
    /**
     * Whether sending the event should block the UI after a certain delay.
     * The default value 'undefined' means that the default value ('true') is determined in the {@link Session}.
     * We don't write it explicitly to the event here because that would break many Jasmine tests.
     */
    showBusyIndicator?: boolean;
    /**
     * Default is false.
     */
    newRequest?: boolean;
}
//# sourceMappingURL=ModelAdapter.d.ts.map