import { AppTryLoginParams, CoreApp, FormatResultCustomCallback, IApp, IAppSettings, ICoreApp, IUser } from "@etsoo/appscript";
import { INotifier, NotificationReturn } from "@etsoo/notificationbase";
import { DataTypes, IActionResult } from "@etsoo/shared";
import React from "react";
import { CultureAction, CultureState, INotificationReact, InputDialogProps, IStateProps, NotificationReactCallProps, UserAction, UserState } from "@etsoo/react";
import { NavigateFunction, NavigateOptions } from "react-router";
/**
 * React Application Type
 */
export type ReactAppType = IApp & IReactAppBase;
/**
 * React application context
 */
export declare const ReactAppContext: React.Context<ReactAppType | null>;
/**
 * Get React application context hook
 * @returns React application
 */
export declare function useAppContext(): ReactAppType | null;
/**
 * Get React application context hook
 * @returns React application
 */
export declare function useRequiredAppContext(): IApp & IReactAppBase;
/**
 * React implemented base
 */
export interface IReactAppBase {
    /**
     * Override Notifier as React specific
     */
    readonly notifier: INotifier<React.ReactNode, NotificationReactCallProps>;
    /**
     * Is screen size down 'sm'
     */
    smDown?: boolean;
    /**
     * Is screen size up 'md'
     */
    mdUp?: boolean;
    /**
     * Get date format props
     * @returns Props
     */
    getDateFormatProps(): object;
    /**
     * Get money format props
     * @param currency Currency, if undefined, default currency applied
     * @returns Props
     */
    getMoneyFormatProps(currency?: string): object;
    /**
     * Show input dialog
     * @param props Props
     */
    showInputDialog({ title, message, callback, ...rest }: InputDialogProps): INotificationReact;
    /**
     * State detector component
     * @param props Props
     */
    stateDetector(props: IStateProps): React.ReactNode;
}
/**
 * Core application interface
 */
export interface IReactApp<S extends IAppSettings, D extends IUser> extends ICoreApp<D, S, React.ReactNode, NotificationReactCallProps>, Omit<IReactAppBase, "userState"> {
    /**
     * User state
     */
    readonly userState: UserState<D>;
}
/**
 * React application
 */
export declare class ReactApp<S extends IAppSettings, D extends IUser> extends CoreApp<D, S, React.ReactNode, NotificationReactCallProps> implements IReactApp<S, D> {
    private static _notifierProvider;
    /**
     * Get notifier provider
     */
    static get notifierProvider(): React.FunctionComponent<DataTypes.StringRecord>;
    private static createNotifier;
    /**
     * Culture state
     */
    readonly cultureState: CultureState;
    /**
     * User state
     */
    readonly userState: UserState<D>;
    /**
     * Is screen size down 'sm'
     */
    smDown?: boolean;
    /**
     * Is screen size up 'md'
     */
    mdUp?: boolean;
    /**
     * Navigate function
     */
    navigateFunction?: NavigateFunction;
    /**
     * User state dispatch
     */
    userStateDispatch?: React.Dispatch<UserAction<D>>;
    /**
     * Constructor
     * @param settings Settings
     * @param name Application name
     * @param debug Debug mode
     */
    constructor(settings: S, name: string, debug?: boolean);
    /**
     * Override alert action result
     * @param result Action result
     * @param callback Callback
     * @param forceToLocal Force to local labels
     */
    alertResult(result: IActionResult | string, callback?: NotificationReturn<void>, forceToLocal?: FormatResultCustomCallback): void;
    /**
     * Change culture
     * @param culture New culture definition
     */
    changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
    /**
     * Change culture extended
     * @param dispatch Dispatch method
     * @param culture New culture definition
     */
    changeCultureEx(dispatch: React.Dispatch<CultureAction>, culture: DataTypes.CultureDefinition): void;
    /**
     * Get date format props
     * @returns Props
     */
    getDateFormatProps(): {
        culture: string;
        timeZone: string;
    };
    /**
     * Get money format props
     * @param currency Currency, if undefined, default currency applied
     * @returns Props
     */
    getMoneyFormatProps(currency?: string): {
        culture: string;
        currency: string;
    };
    /**
     * Fresh countdown UI
     * @param callback Callback
     */
    freshCountdownUI(callback?: () => PromiseLike<unknown>): void;
    /**
     * Try login
     * @param data Try login parameters
     * @returns Result
     */
    tryLogin(data?: AppTryLoginParams): Promise<boolean>;
    /**
     * Check if the action result should be ignored during try login
     * @param result Action result
     * @returns Result
     */
    protected tryLoginIgnoreResult(result: IActionResult): boolean;
    /**
     * Navigate to Url or delta
     * @param url Url or delta
     * @param options Options
     */
    navigate<T extends number | string | URL>(to: T, options?: T extends number ? never : NavigateOptions): void;
    /**
     * Show input dialog
     * @param props Props
     */
    showInputDialog({ title, message, callback, ...rest }: InputDialogProps): INotificationReact;
    stateDetector(props: IStateProps): React.FunctionComponentElement<React.FragmentProps>;
    /**
     * User login extended
     * @param user New user
     * @param refreshToken Refresh token
     * @param dispatch User state dispatch
     */
    userLogin(user: D, refreshToken: string, dispatch?: boolean): void;
    /**
     * User login callback
     * @param user New user
     */
    protected onUserLogin(user: D): Promise<void>;
    /**
     * User login dispatch
     * @param user New user
     */
    protected doLoginDispatch(user: D): void;
    /**
     * User logout
     * @param clearToken Clear refresh token or not
     * @param noTrigger No trigger for state change
     */
    userLogout(clearToken?: boolean, noTrigger?: boolean): void;
    /**
     * User unauthorized
     */
    userUnauthorized(): void;
}
