/*!
 * Copyright 2017 - 2020 by ChartIQ, Inc.
 * All rights reserved.
 */
import { _BaseClient } from "./baseClient";
import { Workspace, ActiveWorkspace } from "../common/workspace";
import { FinsembleWindowData } from "../common/FinsembleWindowData";
import { RouterResponse } from "./routerClientInstance";
import { StateType, CompleteWindowState } from "../common/windowStorageManager";
import FinsembleEvent from "../common/events/FinsembleEvent";
import PublicEventManager from "../common/events/PublicEventManager";
import { StandardErrorCallback, StandardPromise } from "../types";
import { WorkspaceEventName } from "../services/workspace/types";
declare type FinsembleEventHandler = (event: FinsembleEvent) => void;
/**
 * @introduction
 * <h2>Workspace Client (Finsemble Workspaces)</h2>
 * ----------
 * The Workspace Client manages all calls to load, save, rename, and delete workspaces.
 *
 *
 * The Workspace Client uses the <code>windowIdentifier</code> parameter. <a href="tutorial-ComponentTypesAndWindowNames.html">Learn more about them here</a>.
 *
 *
 * See the <a href="tutorial-Workspaces.html">Workspace tutorial</a> for an overview of using the Workspace Client.
 *
 * @hideConstructor true
 * @constructor
 * @summary You don't need to ever invoke the constructor. This is done for you when WindowClient is added to the FSBL object.
 */
export declare class WorkspaceClient extends _BaseClient {
    /**
     * List of all workspaces names within the application.
     *
     * @type {Array.<string>}
     */
    workspaces: string[];
    publicEventManager: PublicEventManager;
    /**
     * Reference to the activeWorkspace object
     * @type {object}
     */
    activeWorkspace: ActiveWorkspace | undefined;
    constructor(params: any);
    private _serviceResponseHandler;
    /**
     * This provides the ability to listen to workspace events.
     * The load-requested event provides a way to merge data into the workspace prior to loading.
     * The close-requested and save-requested event, allow you to perform actions prior to the actual save and close.
     * The rest of the events are informational only.
     * To tell the workspace service to wait, you must call event.wait() in less than one second.
     * To cancel event.cancel() must be called within 10 seconds, otherwise done is assumed.
     * To send data event.done(data) must also be called within 10 seconds, otherwise done with no data is assumed.
     * @param {WorkspaceEventName} event
     * @param {FinsembleEventHandler} handler
     * @example
     * // Sync examples:
     * FSBL.Clients.WorkspaceClient.addEventListener("close-requested", (event) => { doSomething(); })
     * FSBL.Clients.WorkspaceClient.addEventListener("load-requested", (event) => { const data = doSomething(); event.done(data); })
     *
     * // Async examples:
     * FSBL.Clients.WorkspaceClient.addEventListener("close-requested", async (event) => { event.wait(); await doSomething(); event.done(); })
     * FSBL.Clients.WorkspaceClient.addEventListener("load-requested", async (event) => { event.wait(); const data = await doSomething(); event.done(data); })
     */
    addEventListener(event: WorkspaceEventName, handler: FinsembleEventHandler): void;
    removeEventListener(event: WorkspaceEventName, handler: FinsembleEventHandler): void;
    /**
     * Adds window to active workspace.
     * @private
     * @param {object} params
     * @param {string} params.name Window name
     * @param {function} cb Optional callback to be invoked after the method completes successfully.
     */
    addWindow(params: FinsembleWindowData, cb?: any): Promise<import("./routerClientInstance").QueryResponse<any>>;
    /**
     * Removes window from active workspace.
     * @private
     * @param {object} params
     * @param {string} params.name Window name
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This method removes a window from a workspace. It is rarely called by the developer. It is called when a window that is using the window manager is closed. That way, the next time the app is loaded, that window is not spawned.</caption>
     * FSBL.Clients.WorkspaceClient.removeWindow({ name:windowName }, function(err, response) {
     * 	//do something after removing the window.
     * });
     */
    removeWindow(params: {
        name: string;
    }, cb?: Function): void;
    /**
     * This method is an experimental feature in Finsemble Labs. Calling this method automatically arranges all windows on the user's screen into a grid-like pattern.
     * @param {object} params Parameters
     * @param {string | undefined} params.monitor Same options as <a href="LauncherClient.html#showWindow">LauncherClient.showWindow</a>. Default is monitor of calling window.
     * @param {* | undefined} params.monitorDimensions The surface area of the monitor to arrange over. If not defined defaults to the available area of the current monitor.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example
     * FSBL.Clients.WorkspaceClient.autoArrange();
     * FSBL.Clients.WorkspaceClient.autoArrange({}, function(err) {
     * 		//do something after the auto-arrange, maybe make all of the windows flash or notify the user that their monitor is now tidy.
     * });
     */
    autoArrange(params: {
        monitor?: string;
        monitorDimensions?: any;
    }, cb?: StandardErrorCallback<void>): StandardPromise<void>;
    /**
     * Minimizes all windows.
     * @param {object} params
     * @param {string} 	params.monitor Same options as <a href="LauncherClient.html#showWindow">LauncherClient.showWindow</a> except that "all" will work for all monitors. Defaults to all.
     * @param {* | undefined} params.windowIdentifier The Finsemble identifier structure for the window triggering the request.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example
     * FSBL.Clients.WorkspaceClient.minimizeAll();
     * FSBL.Clients.WorkspaceClient.minimizeAll({monitor: "all"}, function(err){
     * 	// do something
     * });
     */
    minimizeAll(params?: {
        monitor: string;
        windowIdentifier?: any;
    }, cb?: StandardErrorCallback<void>): StandardPromise<void>;
    /**
     * Brings all windows to the front.
     * @param {object} params
     * @param {string} 	params.monitor Same options as <a href="LauncherClient.html#showWindow">LauncherClient.showWindow</a> except that "all" will work for all monitors. Defaults to the monitor for the current window.
     * @param {* | undefined} params.windowIdentifier The Finsemble identifier for the target window. If not provided, defaults to the current window.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example
     * FSBL.Clients.WorkspaceClient.bringWindowsToFront();
     * FSBL.Clients.WorkspaceClient.bringWindowsToFront({monitor: "all"}, function(err){
     * 	// do something
     * });
     */
    bringWindowsToFront(params?: {
        monitor: string;
        windowIdentifier?: any;
    }, cb?: StandardErrorCallback<void>): StandardPromise<void>;
    /**
     * Gets the currently active workspace.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This function is useful for setting the initial state of a menu or dialog. It is used in the toolbar component to set the initial state.</caption>
     *
     * FSBL.Clients.WorkspaceClient.getActiveWorkspace((err, response) => {
     * 	// do something with the response.
     * });
     */
    getActiveWorkspace(cb?: StandardErrorCallback<{
        data: Workspace;
    }>): Promise<{
        data: Workspace;
    }>;
    /**
     * Returns the list of saved workspaces.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This function is useful for setting the initial state of a menu or dialog.</caption>
     *
     * FSBL.Clients.WorkspaceClient.getWorkspaces((err, response) => {
     *   //do something with the array of workspace objects
     *   console.log(response)
     * });
     */
    getWorkspaces(cb?: any): Promise<unknown>;
    /**
     * Gets workspace actions defined as constants. Allows users to filter
     * updates
     *
     * @param {function} cb The callback to be invoked after the method completes successfully.
     */
    getWorkspaceActions(cb?: any): any;
    /**
     * Returns a list of workspace names
     *
     * @example <caption>This function returns the list of all the workspace.</caption>
     * FSBL.Clients.WorkspaceClient.getWorkspaceNames((err, response) => {
     *   console.log(JSON.stringify(response, null, 2));
     * });
     *
     *
     * Output:
     * [
     *   "Default Workspace",
     *   "Another workspace"
     * ]
     *
     * @param {function} cb The callback to be invoked after the method completes successfully.
     */
    getWorkspaceNames(cb?: any): Promise<unknown>;
    /**
     * @private
     *
     * @param {*} params
     * @param {*} cb
     * @returns
     * @memberof WorkspaceClient
     */
    setWorkspaceOrder(params: any, cb: any): Promise<unknown>;
    setWorkspaces: (params: any, cb: any) => Promise<unknown>;
    /**
     * Removes a workspace. Either the workspace object or its name must be provided.
     * @param {object} params
     * @param {object | undefined} 	params.workspace The workspace data object.
     * @param {string} 	params.workspace.name The workspace name removal is requested for.
     * @param {string | undefined} 	params.name The workspace name removal is requested for.
     * @param {function} cb Callback to fire after 'Finsemble.WorkspaceService.update' is transmitted.
     * @example <caption>This function removes 'My Workspace' from the main menu and the default storage tied to the application.</caption>
     * FSBL.Clients.WorkspaceClient.remove({
     * 	name: 'My Workspace'
     * }, function(err, response) {
     * 	//You typically won't do anything here. If you'd like to do something when a workspace change happens, we suggest listening on the `Finsemble.WorkspaceService.update` channel.
     * });
     */
    remove(params: {
        workspace?: {
            name: string;
        };
        name?: string;
    }, cb?: Function): Promise<unknown>;
    /**
     * Renames the workspace with the provided name. Also removes all references in storage to the old workspace's name.
     * @param {object} params
     * @param {string} params.oldName Name of workspace to rename.
     * @param {string} params.newName What to rename the workspace to.
     * @param {boolean} params.removeOldWorkspace Whether to remove references to old workspace after renaming.
     * @param {boolean} params.overwriteExisting Whether to overwrite an existing workspace.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This method is used to rename workspaces. It is used in the main Menu component. Note: If you attempt to rename a Workspace to a name that already exists a ({next number}) will be added to the newName.</caption>
     * FSBL.Clients.WorkspaceClient.rename({
     * 	oldName: 'My Workspace',
     * 	newName: 'The best workspace',
     * 	removeOldWorkspace: true,
     * }, function(err, response) {
     * 	//Do something.
     * });
     */
    rename(params: {
        oldName: string;
        newName: string;
        removeOldWorkspace?: boolean;
        overwriteExisting?: boolean;
    }, cb?: Function): Promise<unknown>;
    /**
     * Saves the currently saved workspace. Changes to the <code>activeWorkspace</code> are made on every change automatically.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This function persists the currently active workspace.</caption>
     * FSBL.Clients.WorkspaceClient.save(function(err) {
     * 	//Do something.
     * });
     */
    save(cb?: Function): Promise<unknown>;
    /**
     * Helper that tells us whether a workspace with this name exists.
     * @private
     */
    workspaceExists(workspaceName: any): boolean;
    /**
     *
     * Saves the currently active workspace with the provided name.
     * @param {object} params
     * @param {string} params.name The new name you want to save the workspace under.
     * @param {string} [params.force] Whether to overwrite a workspace already saved with the provided name.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This function persists the currently active workspace with the provided name.</caption>
     * FSBL.Clients.WorkspaceClient.saveAs({
     * 	name: 'My Workspace',
     * }, function(err, response) {
     * 	//Do something.
     * });
     */
    saveAs(params: {
        name?: string;
        force?: boolean;
    }, cb?: Function): Promise<unknown>;
    /**
     * Switches to a workspace.
     * @param {object} params
     * @param {string} 	params.name The name of the workspace you want to switch to.
     * @param {function} cb The callback to be invoked after the method completes successfully.
     * @example <caption>This function loads the workspace 'My Workspace' from the storage tied to the application.</caption>
     * FSBL.Clients.WorkspaceClient.switchTo({
     * 	name: 'My Workspace',
     * }, function(err, response) {
     * 	//Do something.
     * });
     */
    switchTo(params: {
        name: string;
    }, cb?: StandardErrorCallback<{
        data: Workspace;
    }>): Promise<{
        data: Workspace;
    }>;
    /**
     * @private
     * ALPHA - Subject to breaking change in coming minor releases.
     * Sets the stored state of a given window in the active workspace. `state` may include
     * keys for `windowData`, `componentState`, or both; the state of each key will be completely
     * overwritten by the provided state. If the update results in dirtying change, the active
     * workspace will be marked dirty (or, if auto save is on, persisted directly to storage).
     */
    _setWindowState(params: {
        windowName: string;
        state: Partial<CompleteWindowState>;
    }): Promise<RouterResponse<boolean>>;
    /**
     * @private
     * ALPHA - Subject to breaking change in coming minor releases.
     * Retrieves the given window from storage, retrieving the requested state variables
     * (`"componentState"` and/or `"windowData"`).
     */
    _getWindowState(params: {
        windowName: string;
        stateVars: StateType[];
    }): Promise<RouterResponse<Partial<CompleteWindowState>>>;
    /**
     * Checks to see if the workspace is dirty, i.e., if its state has been changed since the last save. If it's already dirty, the window doesn't need to compare its state to the saved state.
     *
     * @param {Function} cb <code>cb(err,response)</code> with response set to true if dirty and false otherwise (when no error).
     *
     * @example <caption>This function will let you know if the <code>activeWorkspace</code> is dirty.</caption>
     * FSBL.Clients.WorkspaceClient.isWorkspaceDirty(function(err, response) {
     *     if (response.data === true) {
     *         //Do something like prompt the user if they'd like to save the currently loaded workspace before switching.
     *    } else {
     *        //Workspace is clean
     *    }
     * });
     */
    isWorkspaceDirty(cb?: Function): Promise<any>;
    /**
     * Creates a new workspace, returning a promise for the final name of
     * the new workspace as a string. After creation, if "switchAfterCreation" is true,
     * the new workspace becomes the active workspace.
     *
     * If the requested name already exists, a new workspace will be created
     * with the form "[name] (1)" (or "[name] (2)", etc.)
     *
     *

     * @param {string} workspaceName Name for new workspace. If the workspaceName is empty, the workspace is given the name "Untitled." Subsequent creations with empty strings would result in "Untitled1", "Untitled2", etc.
     * @param {object} params Optional params
     * @param {boolean} params.switchAfterCreation Whether to switch to the new workspace after creating it. Defaults to true.
     * @param {function} cb <code>cb(err,response)</code> With response, set to new workspace object if no error.
     * @example <caption>This function creates the workspace 'My Workspace'.</caption>
     * FSBL.Clients.WorkspaceClient.createWorkspace("My workspace", {switchAfterCreation:true}),function(err, response) {
     *		if (!err) {}
     *			//Do something, such as notify the user that the workspace has been created.
     *		}
     * });
     */
    createWorkspace(workspaceName: string, params: {
        switchAfterCreation?: boolean;
    }, cb?: (err: any, result: {
        workspaceName: string;
    }) => void): Promise<{
        workspaceName: string;
    }>;
    /**
     * @private
     */
    createNewWorkspace: (workspaceName: string, params: {
        switchAfterCreation?: boolean;
    }, cb?: (err: any, result: {
        workspaceName: string;
    }) => void) => Promise<{
        workspaceName: string;
    }>;
    /**
     * Gets a workspace definition in JSON form.
     *
     * @param {object} params
     * @param {string} params.workspaceName The name of the workspace you want to export.
     * @param {function} cb <code>callback(error, workspaceDefinition)</code>
     * @example
     * FSBL.Clients.WorkspaceClient.export({'workspaceName': 'linker'}, function(err, workspaceDefinition) {
     * 	//do something with the workspace definition
     * });
     */
    export(params: {
        workspaceName: string;
    }, cb: any): Promise<unknown>;
    getWorkspaceDefinition: (params: {
        workspaceName: string;
    }, cb: any) => Promise<unknown>;
    /**
     * Adds a workspace definition to the list of available workspaces.
     *
     * @param {object} params
     * @param {object} params.workspaceJSONDefinition The JSON for the workspace definition, as exported by the User Preferences menu in Finsemble Connect.
     * @param {boolean} params.force Whether to overwrite any workspace of the same name that already exists
     * @param {function=} cb <code>cb(err)</code> where the operation was successful if !err; otherwise, err carries diagnostics
     * @example
     * FSBL.Clients.WorkspaceClient.import({force: false, workspaceJSONDefinition: workspaceDefinition}, function(err) {
     *		if (!err) console.log("import success.");
     * });
     */
    import(params: {
        workspaceJSONDefinition: Record<string, Workspace | string>;
        force: boolean;
    }, cb?: any): Promise<Record<string, string>>;
    addWorkspaceDefinition: (params: {
        workspaceJSONDefinition: Record<string, Workspace | string>;
        force: boolean;
    }, cb?: any) => Promise<Record<string, string>>;
    /**
     * Saves one mor more template definitions in a selected file. Note the
     * end user is prompted to identify file location during this save
     * operation. The file can optionally be imported during config
     * initialization (see importConfig) although this requires administration
     * support on the configuration/server side. The file can also be read
     * using readWorkspaceTemplateFromConfigFile();
     *
     * @param {object} params
     * @param {object} params.workspaceTemplateDefinition legal template definition returned by either
     * getWorkspaceTemplateDefinition() or convertWorkspaceDefinitionToTemplate()
     * @private
     */
    exportToFile(params: {
        workspaceTemplateDefinition: any;
    }): void;
    saveWorkspaceTemplateToConfigFile: (params: {
        workspaceTemplateDefinition: any;
    }) => void;
    /**
     * Initializes listeners and sets default data on the WorkspaceClient object.
     *
     * @private
     */
    start(cb: any): Promise<void>;
}
declare let workspaceClient: WorkspaceClient;
export default workspaceClient;
//# sourceMappingURL=workspaceClient.d.ts.map