import { IKosIdentifiable } from './types/model';
import { IKosDataModel } from './kosModel';
import { IKosContainerIndex, IndexMapper } from './kos-container-index';
import { KosData } from '../util/observable-proxy-map';

export interface IKosBaseContainer<T extends IKosIdentifiable> {
    revision: number;
    data: T[];
    idx: KosData<Record<string, Record<string, T[]>>>;
    index: Map<string, IKosContainerIndex<T>>;
    indexKeys: Record<string, string[] | undefined>;
    addModel: (model: T) => void;
    removeModel: (id: string) => void;
    addAll: (models: T[]) => void;
    removeAll: (ids: string[]) => void;
    getModel: (id: string) => T | undefined;
    increment: () => void;
    clear: () => Promise<void>;
    map: (typeof Array.prototype)["map"];
    filter: (typeof Array.prototype)["filter"];
    sort: (typeof Array.prototype)["sort"];
    [Symbol.iterator](): IterableIterator<T>;
}
export interface IKosModelContainer<T extends IKosDataModel> extends IKosBaseContainer<T> {
    updateModel: (model: T) => void;
    getModel: (id: string) => T | undefined;
    getIndexByKey: (indexName: string, indexKey: string) => T[];
    getIndexKeys: (indexName: string) => string[];
    toJSON?: () => object;
}
interface ContainerOptions<T extends IKosDataModel> {
    sortKey?: keyof T;
    indexMap?: Record<string, keyof T | IndexMapper<T>>;
    parentId?: string;
    extensionId?: string;
}
export declare class KosModelContainer<T extends IKosDataModel> implements IKosModelContainer<T> {
    _data: Map<string, T>;
    private _sortKey?;
    private _revision;
    private _index;
    private _optionsMap;
    private _disposerMap;
    private _parentId?;
    idx: KosData<Record<string, Record<string, T[]>>>;
    constructor(options?: ContainerOptions<T>);
    init(): void;
    [Symbol.iterator](): IterableIterator<T>;
    get index(): Map<string, IKosContainerIndex<T>>;
    get revision(): number;
    get indexKeys(): Record<string, string[] | undefined>;
    sortFn(a: any, b: any): number;
    get data(): T[];
    increment(): void;
    addAll(models: T[]): void;
    removeAll(ids: string[]): void;
    addModel(model: T, defer?: boolean): void;
    removeModel(id: string, defer?: boolean): void;
    updateModel(model: T): void;
    getModel(id: string): T | undefined;
    getIndexKeys(indexName: string): string[];
    getIndexByKey(indexName: string, indexKey: string): T[];
    clear(): Promise<void>;
    filter<S extends any>(predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): T[];
    sort(compareFn?: ((a: any, b: any) => number) | undefined): T[];
    map<U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any): U[];
    forEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void;
    toJSON(): {
        indexes: Record<string, string[] | undefined>;
        data: {
            id: string;
            type: string;
        }[];
    };
}
export {};
//# sourceMappingURL=kos-container-model.d.ts.map