import { Unsubscribable } from 'rxjs';
import { ProviderMap, PanelViewData, ClientThreadViewsShape } from '@workbench-stack/extension-api';
import { IContent } from '@files-stack/client-core';

/** @internal */
export class WebExtHostEditorWindows implements Unsubscribable {
    private registrations = new ProviderMap<{}>(id => this.proxy.$unregister(id));

    constructor(private proxy: any) { }

    public openWindow(content: IContent): Promise<number> {
        return this.proxy.$openWindow(content);
    }

    public closeWindow(content: IContent) {
        // TODO: close editor by ID
        return this.proxy.$closeWindow(content);
    }

    public updateWindow(content: IContent) {
        // // TODO: update editor by ID and part content
        return this.proxy.$updateWindow(content);
    }

    public selectWindow(content: IContent) {
        // TODO: activate editor by ID
        return this.proxy.$selectWindow(content);
    }

    public unsubscribe(): void {
        this.registrations.unsubscribe();
    }
}
