import { DefaultTheme } from 'styled-components';
import { History, To } from 'history';
import type { IMicroAppGuest, IMicroAppHost, InitOptions, MountOptions } from '@elliemae/pui-micro-frontend-base';
import { SSFHost } from '@elliemae/ssf-host';
import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
import { IMicroFEHost } from '@elliemae/pui-app-bridge';
import type { ScriptingObjects, EventListeners, SubscribeParam, UnsubscribeParam, DispatchEventParam, EventOptions, AddScriptingObjectParams } from '@elliemae/microfe-common';
import { SSFGuest } from '@elliemae/ssf-guest';
import { LogRocket } from '@elliemae/pui-logrocket';
import { JSONValue, MicroFrontEndLogger } from '../types.js';
export interface GuestProps<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> extends InitOptions<AppObjects, AppEvents> {
    prevState: JSONValue | null;
    history: History;
    theme: DefaultTheme;
}
export type OnInitCallback = (options: GuestProps) => void;
export type OnMountCallback = (options: MountOptions) => void;
export type OnUnMountCallback = (options: MountOptions) => JSONValue;
export type OnGetRefCallback = <T>() => T | null;
interface ConstructorParams {
    logger?: MicroFrontEndLogger;
    logRocket?: typeof LogRocket;
    onInit?: OnInitCallback;
    onMount?: OnMountCallback;
    onUnmount?: OnUnMountCallback;
    onGetRef?: OnGetRefCallback;
    history?: History;
    ssfHostRef?: SSFHost<ScriptingObjectTypes, Events> | null;
    /**
     * true if the app prefers to use SSF V2 Guest from App SDK to communicate with host(optional, default: true)
     */
    useV2Guest?: boolean;
}
export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> implements IMicroAppGuest<AppObjects, AppEvents> {
    #private;
    private static instance;
    private readonly logger;
    private readonly appId;
    private props;
    private containerId;
    private readonly onInit?;
    private readonly onMount?;
    private readonly onUnmount?;
    private readonly onGetRef?;
    private constructor();
    static getInstance<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events>(params?: ConstructorParams): CMicroAppGuest<AppObjects, AppEvents>;
    static isInitialized(): boolean;
    static isHosted(): boolean;
    getHost(): IMicroAppHost<Partial<ScriptingObjectTypes>, Events> | IMicroFEHost<Partial<ScriptingObjectTypes>, Events> | SSFGuest<Partial<ScriptingObjectTypes>, Events> | undefined;
    getLogger(): MicroFrontEndLogger;
    getObject<ObjectId extends Extract<keyof AppObjects, string>>(objectId: ObjectId): Promise<AppObjects[ObjectId] | null>;
    /**
     * subscribe to the scripting object event
     * @param {SubscribeParam<EventId, AppEvents[EventId]>} params - the parameters for the subscription
     * @param {string} params.soName - the name of the scripting object
     * @param {string} params.eventName - the name of the event
     * @param {Function} params.callback - the callback function to be called when the event is triggered
     * @returns {void}
     */
    subscribe<EventId extends Extract<keyof AppEvents, string>>(params: SubscribeParam<EventId, AppEvents[EventId]>): string;
    /**
     * unsubscribe from the scripting object event
     * @param params - parameters for the unsubscription
     */
    unsubscribe<EventId extends Extract<keyof AppEvents, string>>(params: UnsubscribeParam<EventId>): void;
    getProps(): GuestProps<Partial<ScriptingObjectTypes>, Events>;
    private getSessionStorageItem;
    private findHost;
    get uuid(): string;
    init(options: InitOptions<AppObjects, AppEvents>): Promise<void>;
    mount(options?: MountOptions): Promise<void>;
    unmount(options: MountOptions): Promise<JSONValue>;
    getRef<T>(): T | null;
    navigate(url: To, state?: any): void;
    /**
     * add scripting object for child microapp to use
     * @param so - The scripting object to be added.
     * @param params - Optional parameters for adding the scripting object.
     */
    addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
    /**
     * Dispatches an event to the child microapp.
     * @param {DispatchEventParam<EventId, Params, Options>} params - Event parameters.
     * @returns {Promise<any[]>} A promise that resolves with the combined results of dispatched events.
     */
    dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void | any[]>;
    /**
     * removes scripting object from child microapp use
     * @param objectId unique id of the scripting object
     */
    removeScriptingObject(objectId: Extract<keyof AppObjects, string>): void;
}
export {};
