import type { HDict } from 'haystack-core';
import type { App } from './App';
import type { AppAccessLevel } from './AppAccessLevel';
import type { AppView } from './AppView';
import type { CustomHistory } from './CustomHistory';
/**
 * The interface for the application's root store.
 */
export interface AppRootStore {
    /**
     * @returns The current main application being rendered by the shell or undefined
     * if there is no application view loaded.
     */
    readonly app: {
        id: string;
        name: string;
        app: App;
        view: AppView;
    } | undefined;
    /**
     * @returns The current sidebar application being rendered by the shell or
     * undefined if there is no sidebar application view loaded.
     */
    readonly sidebar: {
        id: string;
        name: string;
        app: App;
        view: AppView;
    } | undefined;
    /**
     * The currently installed applications.
     */
    readonly apps: App[];
    /**
     * The current loaded project.
     *
     * Setting this will change the project currently being used.
     *
     * ```
     * console.log(`The project name is ${appRootStore.project}`)
     *
     * // Select a different project...
     * appRootStore.project = 'foo'
     * ```
     */
    project: string;
    /**
     * A boolean flag used to toggle whether the sidebar is open or not.
     *
     * Changing this will toggle whether the sidebar is showing or not.
     *
     * ```
     * if (appRootStore.sidebarOpen) {
     *   ...
     * }
     *
     * // Close the sidebar...
     * appRootStore.sidebarOpen = false
     * ```
     */
    sidebarOpen: boolean;
    /**
     * Opens an application's view in the main view.
     *
     * ```
     * // Open an app's main view
     * appRootStore.open('finUi.myApp.main', { param: 'some param' })
     * ```
     *
     * @param appViewId The id of the application view to open.
     * This is the application's full id i.e. `myApp.myView`.
     * @param state The state to load for the application.
     */
    open(appViewId: string, state?: Record<string, unknown>): void;
    /**
     * Opens an application's view in a new browser window/tab.
     *
     * ```
     * // Open an app's main view in a new browser window/tab
     * appRootStore.openAppWindow('finUi.myApp.main', { param: 'some param' })
     * ```
     *
     * @param appViewId The id of the application view to open.
     * This is the application's full id i.e. `myApp.myView`.
     * @param state The state to load for the application.
     */
    openAppInNewWindow(appViewId: string, state?: Record<string, unknown>): void;
    /**
     * Opens an application in the sidebar view.
     *
     *  ```
     * // Open an app's main view
     * appRootStore.open('finUi.myApp.main', { param: 'some param' })
     * ```
     *
     * @param appViewId The id of the application view to open.
     * This is the application's full id i.e. `myApp.mySidebarView`.
     * @param state The state to load for the application.
     */
    openSidebar(appViewId: string, state?: Record<string, unknown>): void;
    /**
     * The current locale being used.
     *
     * ```
     * console.log(`The current user's locale is ${appRootStore.locale}`)
     * ```
     */
    readonly locale: string;
    /**
     * All the locales available to use.
     *
     * ```
     * console.log(`All the supported locales are ${appRootStore.allLocales}`)
     * ```
     */
    readonly allLocales: string[];
    /**
     * The current context's target. An empty string means no target is
     * currently selected.
     *
     * Changing this will also change the target.
     *
     * ```
     * console.log(`The current target is ${appRootStore.target}`)
     *
     * // Change the target...
     * const ref = HRef.make('p:foo:sometarget')
     * appRootStore.target = ref.value
     * ```
     */
    target: string;
    /**
     * The current context's target for the sidebar. An empty string means
     * the sidebar's target will fallback to the main target.
     *
     * Changing this will also change the target for the sidebar.
     *
     * * ```
     * console.log(`The current target is ${appRootStore.targetSidebar}`)
     *
     * // Change the target for the sidebar...
     * const ref = HRef.make('p:foo:sometarget')
     * appRootStore.targetSidebar = ref.value
     */
    targetSidebar: string;
    /**
     * The shell's history for the main view.
     *
     * ```
     * appRootStore.history.pushState({ query: 'site and geoCity == "Brighton and Hove"' })
     * ```
     */
    readonly history: CustomHistory;
    /**
     * The shell's history for the sidebar view.
     *
     * ```
     * appRootStore.history.pushState({ query: 'site and geoCity == "Brighton and Hove"' })
     * ```
     */
    readonly historySidebar: CustomHistory;
    /**
     * The record for for the currently logged in user.
     */
    readonly currentUser?: HDict;
    /**
     * Post a message to the system. The message will be received via
     * an application's {@link AppStore.onMessage} callback. Please note,
     * an application also needs to declare the messages its interested in
     * via {@link App.messages}.
     *
     * ```
     * appRootStore.postAppMessage('newMessage', { data: 'some data' })
     * ```
     *
     * @param message The message to dispatch.
     * @param params The parameters for the message.
     */
    postAppMessage(message: string, params?: Record<string, unknown>): void;
    /**
     * Register dynamic sidebar application views. This is used to dynamically
     * add temporary sidebar application views at runtime. These sidebar views are
     * registered from a main application view. They are only available whilst the
     * the current main application view is open.
     *
     * ```
     * appRootStore.registerSidebars({
     *   myDynamicSidebar: {
     *     // Sidebar AppView content
     *   }
     * })
     * ```
     *
     * @param sidebars The sidebar views to add.
     */
    registerSidebars(sidebars: Record<string, AppView>): void;
    /**
     * Verifies if a sidebar application is currently registered.
     * ```
     * const sidebars = {
     *   myDynamicSidebar: {
     *     // Sidebar AppView content
     *   }
     * }
     *
     * if (!hasSideBar('myDynamicSidebar')) {
     *     store.registerSidebars(sidebars)
     * }
     * ```
     *
     * @param name The name of the sidebar application to verify registration.
     * @returns true if the sidebar application is currently registered.
     */
    hasSidebar(name: string): boolean;
    /**
     * Unregister sidebars for an application. Only dynamic sidebars that were previously
     * added via {@link AppRootStore.registerSidebars} will be unregistered.
     *
     * Please note, all dynamic sidebars are automatically unregistered when the
     * current application view unloads.
     *
     * ```
     * const sidebars = {
     *   myDynamicSidebar: {
     *     // Sidebar AppView content
     *   }
     * }
     *
     * store.registerSidebars(sidebars)
     * ...
     * store.unregisterSidebars(sidebars)
     * }
     * ```
     *
     * @param sidebars The sidebars to remove.
     */
    unregisterSidebars(sidebars: string[] | Record<string, AppView>): void;
    /**
     * Return true if the current user has the specified access to an application.
     *
     * @param app The application's id.
     * @param access The application's access level.
     */
    hasAppAccess(app: string, access: AppAccessLevel): boolean;
}
