import { TemplateResult } from 'lit';
import { IUser, IBackendInfo } from '@api-client/core/build/browser.js';
import { IConfigEnvironment, ThemeType } from '../lib/config/Config.js';
import { StoreBindings } from '../bindings/base/StoreBindings.js';
import type { AddConfigEnvironmentInit, ConfigurationBindings } from '../bindings/base/ConfigurationBindings.js';
import { PlatformBindings } from '../bindings/base/PlatformBindings.js';
import '../define/ui/ui-button.js';
export interface ApplicationInit {
    /**
     * A reference to the store bindings.
     */
    store: StoreBindings;
    /**
     * A reference to the config bindings.
     */
    config: ConfigurationBindings;
}
interface ApplicationBindings {
    /**
     * A reference to the store bindings.
     */
    store: StoreBindings;
    /**
     * A reference to the config bindings.
     */
    config: ConfigurationBindings;
    [key: string]: PlatformBindings;
}
declare const ApplicationScreen_base: (new (...args: any[]) => import("../mixins/RouteMixin.js").RouteMixinInterface) & (new (...args: any[]) => import("../mixins/RenderableMixin.js").RenderableMixinInterface) & {
    new (): EventTarget;
    prototype: EventTarget;
};
/**
 * A base class for pages build outside the LitElement. It uses `lit-html`
 * as the template renderer.
 *
 * The implementation (extending this class) should override the `pageTemplate()`
 * function that returns the `TemplateResult` from the `lit-html` library.
 *
 * To reflect the changed state call the `render()` function. The function schedules
 * a micro task (through `requestAnimationFrame`) to call the render function on the template.
 *
 * Use the `@reactive()` decorator from `src/lib/decorators.js` to mark a property as reactive,
 * meaning, when the property change it calls the `render()` function.
 */
export declare abstract class ApplicationScreen extends ApplicationScreen_base {
    eventTarget: EventTarget;
    /**
     * True when the app should render mobile friendly view.
     */
    isMobile: boolean;
    /**
     * The loading state information.
     */
    loadingStatus: string;
    /**
     * A flag telling the application screen that the logic is initialized.
     *
     * The page can request different initialization logics. When the logic is
     * loaded the flag is set to true.
     */
    initialized: boolean;
    /**
     * The page on the screen currently being rendered.
     */
    page?: string;
    /**
     * The current user.
     * Call the `loadUser()` to populate this.
     */
    user?: IUser;
    /**
     * True when the user meta is being loaded.
     */
    protected loadingUser: boolean;
    protected authenticated: boolean;
    /**
     * This is automatically set when initializing the store.
     * Basic information about the store.
     */
    protected storeInfo?: IBackendInfo;
    /**
     * Checks whether the store is in the single user mode.
     * It also returns true when the store info is not set (before the backend was initialized).
     */
    get isSingleUser(): boolean;
    protected pendingResolver?: (value: void | PromiseLike<void>) => void;
    /**
     * Detected system theme.
     */
    systemTheme: 'light' | 'dark';
    /**
     * The theme to use as selected by the user.
     * Default to system default.
     */
    userTheme: ThemeType;
    /**
     * Application configuration broadcast channel.
     */
    configBroadcast: BroadcastChannel;
    bindings: ApplicationBindings;
    /**
     * The store environment in use.
     * This is set after the `initializeStore()` was called.
     */
    env?: IConfigEnvironment;
    constructor(init: ApplicationInit);
    /**
     * Called once when the page is being initialized.
     */
    abstract initialize(): Promise<void>;
    /**
     * Initializes configuration that is relevant to all application windows.
     */
    initializeConfig(): Promise<void>;
    /**
     * Initializes media queries and observers.
     */
    initMediaQueries(): void;
    protected themeActiveCallback(): void;
    protected activateTheme(type: 'light' | 'dark'): void;
    isPlatformSupported(): Promise<boolean>;
    initStoreChange(): void;
    /**
     * Override in a child class to implement a logic that runs when the default
     * store change in the configuration.
     *
     * @param id The id of the activated environment. When missing it means there's no default environment.
     */
    abstract storeChanged(id?: string): Promise<void>;
    /**
     * Creates a modal dialog with the error details.
     * @param message The message to render
     */
    reportCriticalError(message: string): void;
    unhandledRejectionHandler(e: PromiseRejectionEvent): void;
    protected handleConfigBroadcast(e: MessageEvent): void;
    protected handleLocalConfigUpdated(key: string, value: unknown): void;
    protected handleDefaultEnvironmentSet(env: IConfigEnvironment): void;
    protected handleEnvironmentAdd(env: IConfigEnvironment, init?: AddConfigEnvironmentInit): void;
    /**
     * Called from the initialize store init flow when the user is not authenticated
     * and the auth screen is rendered.
     */
    protected handleAuthenticate(): Promise<void>;
    protected handleOpenStoreConfig(): void;
    /**
     * Initializes the flow where an environment is required.
     * This checks for the default environment.
     * When it doesn't exists it asks the user to pick existing environment
     * or to create one.
     * When a default environment exists, it performs authentication
     * when necessary.
     *
     * Eventually it returns the HTTP store with an authenticated environment.
     *
     * @param defaultFlows When set to `true` is renders default pages for env selector
     * or when to authenticate. When false it throws errors instead. Default to `true`.
     */
    protected initializeStore(defaultFlows?: boolean): Promise<void>;
    loadUser(): Promise<void>;
    private enterEnvironmentMissingFlow;
    private enterAuthenticationRequiredFlow;
    /**
     * Enters into the flow where the application is unable to connect to the data store.
     * It asks user to retry or re-configure.
     *
     * Note, this is called from withing the `initializeStore()` method and this is expected to
     * eventually finish.
     */
    private enterStoreUnavailableFlow;
    protected handleRetryStoreInfo(): Promise<void>;
    private resolvePending;
    /**
     * @returns A template for the page loader
     */
    loaderTemplate(): TemplateResult;
    pageTemplate(): TemplateResult;
    protected headerTemplate(): TemplateResult;
    protected mainTemplate(): TemplateResult;
    protected footerTemplate(): TemplateResult;
    protected navigationTemplate(): TemplateResult;
    protected renderInitFlowPage(): TemplateResult;
    /**
     * Renders a full page overlay with the authentication required message.
     */
    protected renderAuthRequired(): TemplateResult;
    protected renderEnvRequired(): TemplateResult;
    protected renderPlatformNotSupported(): TemplateResult;
    protected renderStoreUnavailable(): TemplateResult;
}
export {};
//# sourceMappingURL=ApplicationScreen.d.ts.map