import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeAll';
import { ICodeState } from '../../redux/code';
export interface ICall {
    method: string;
    params: object;
}
/**
 * Source represents source code for a resource in Interactive.
 */
export declare abstract class Source<T> {
    private lastSrc;
    /**
     * Returns a stream of events to send to the embedded frame. This shuld
     * generally emit whenever the source code is updated.
     */
    getEvents(src: Observable<ICodeState>): Observable<ICall[]>;
    /**
     * Returns a packet to recreate the resources this source owns, if possible.
     */
    getCreatePacket(): ICall[];
    /**
     * Called when the underlying JSON changes. Should return an array of calls
     * to make to update the interactive state from the old state to the new.
     */
    abstract compare(previous: T, next: T): ICall[];
    /**
     * Returns the key of the CodeState where this source reads data from.
     */
    protected abstract sourceProp(): keyof ICodeState;
    /**
     * Returns a method call to make in order to create this source's resources,
     * from the given state.
     */
    protected abstract createPacket(source: T): ICall[];
}
export interface IResourceComparatorOptions<T> {
    id: keyof T;
    nested?: {
        [K in keyof T]?: IResourceComparatorOptions<any>;
    };
    create(sources: T[], context: any): ICall | ICall[];
    update(sources: T[], context: any): ICall | ICall[];
    destroy(id: string, context: any): ICall | ICall[];
}
/**
 * ResourceComparator creates set set of create, update, and destroy
 * calls from a comparison between two resource types.
 */
export declare class ResourceComparator<T> {
    private readonly opts;
    private nested;
    private nestedKeys;
    constructor(opts: IResourceComparatorOptions<T>);
    /**
     * Creates calls to update from A to B.
     */
    compare(previous: T[], next: T[], context?: any): ICall[];
    private compareTopLevel(previous, next, context);
    private id(instance);
}
