import { OPERATION } from './spec';
import { Client, Context, SchemaDefinition, DefinitionType } from "./annotations";
import * as decode from "./encoding/decode";
import { ChangeTree, Ref } from "./changes/ChangeTree";
import { NonFunctionPropNames } from './types/HelperTypes';
import { EventEmitter } from './events/EventEmitter';
export interface DataChange<T = any> {
    op: OPERATION;
    field: string;
    dynamicIndex?: number | string;
    value: T;
    previousValue: T;
}
export interface SchemaDecoderCallbacks {
    onAdd?: (item: any, key: any) => void;
    onRemove?: (item: any, key: any) => void;
    onChange?: (item: any, key: any) => void;
    clone(decoding?: boolean): SchemaDecoderCallbacks;
    clear(decoding?: boolean): any;
    decode?(byte: any, it: decode.Iterator): any;
}
/**
 * Schema encoder / decoder
 */
export declare abstract class Schema {
    static _typeid: number;
    static _context: Context;
    static _definition: SchemaDefinition;
    static onError(e: any): void;
    static is(type: DefinitionType): boolean;
    protected $changes: ChangeTree;
    protected $listeners: {
        [field: string]: EventEmitter<(a: any, b: any) => void>;
    };
    onChange?(changes: DataChange[]): any;
    onRemove?(): any;
    constructor(...args: any[]);
    assign(props: {
        [prop in NonFunctionPropNames<this>]?: this[prop];
    }): this;
    protected get _definition(): SchemaDefinition;
    listen<K extends NonFunctionPropNames<this>>(attr: K, callback: (value: this[K], previousValue: this[K]) => void): () => void;
    decode(bytes: number[], it?: decode.Iterator, ref?: Ref, allChanges?: Map<number, DataChange[]>): Map<number, DataChange<any>[]>;
    encode(encodeAll?: boolean, bytes?: number[], useFilters?: boolean): number[];
    encodeAll(useFilters?: boolean): number[];
    applyFilters(client: Client, encodeAll?: boolean): number[];
    clone(): this;
    triggerAll(): void;
    toJSON(): {};
    discardAllChanges(): void;
    protected getByIndex(index: number): any;
    protected deleteByIndex(index: number): void;
    private tryEncodeTypeId;
    private getSchemaType;
    private createTypeInstance;
    private _triggerAllFillChanges;
    private _triggerChanges;
}
