import { DynamicMFParameters } from '../WindowBase/contexts/DynamicMFParmsContext/types';
import { DynamicMFStore } from '../WindowBase/contexts/DynamicMFParmsContext/store';
import { LayoutItem } from '../GridLayout';
import { MFBaseProps } from '../MFLoader/types';
import { ModuleAction } from '../WindowBase';
import { PopupAddProps } from '../popups/components/PopupsProvider/contexts/PopupsContext/types';
import { DragResizeWindowPropsRND } from '../DragResizeWindowRND/types';
import { JSX_REACT_NODE, WindowOptions, WinType } from '../WindowBase/types';
/**
 * Supported window emergence modes.
 */
export type EmergeType = 'layout' | 'popup' | 'modal' | 'panel';
/**
 * Supported window opening modes.
 */
export type OpenType = 'normal' | 'maximized';
/**
 * Supported docking sides for panel windows.
 */
export type PanelSide = 'left' | 'right' | 'top' | 'bottom';
/**
 * Cookie scopes supported by the Areas runtime.
 */
export type CookieType = 'window' | 'module';
/**
 * Window-level and module-level cookie bags stored per window instance.
 */
export type Cookies = {
    moduleCookies: Record<string, any>;
    windowCookies: Record<string, any>;
};
/**
 * Window loading lifecycle state.
 */
export type WindowStatus = 'init' | 'loading' | 'loaded' | 'error';
/**
 * Reasons that can trigger a guarded window-close request.
 */
export type WindowQueryCloseReason = 'user-close' | 'same-side-replace';
/**
 * Controls exposed to content that wants to intercept a close request.
 */
export type WindowQueryCloseRequest = {
    reason: WindowQueryCloseReason;
    proceed: () => void;
    cancel: () => void;
};
/**
 * Optional window-close guard registered by mounted content.
 */
export type WindowQueryCloseHandler = (request?: WindowQueryCloseRequest) => void;
export type WindowState = {
    /**
     * Current loading lifecycle status.
     */
    status: WindowStatus;
    dynamicMFStore: DynamicMFStore;
    /**
     * Whether the progress bar is visible.
     */
    loading: boolean;
    /**
     * Microfrontend version reported by the mounted content.
     */
    version?: string;
    /**
     * Microfrontend build time reported by the mounted content.
     */
    buildTime?: string;
    /**
     * Actions exposed by the mounted module.
     */
    moduleActions: ModuleAction[];
    /**
     * Window and module cookies.
     */
    cookies: Cookies;
    /**
     * Optional close-confirmation override used by flows such as add/edit MFs.
     */
    fnQueryClose?: WindowQueryCloseHandler;
    /**
     * Visible module duplicate counter inside the same area.
     */
    moduleCount?: number;
};
/**
 * Base payload fields for a new window emitted through the host event bus.
 */
export interface EmmitNewWindowBase {
    /**
     * Emergence mode used to render the window.
     */
    emergeType: EmergeType;
    /**
     * Window content kind.
     */
    winType: WinType;
    /**
     * Backend module identifier.
     */
    moduleId: string;
    /**
     * Runtime parameters passed to the mounted module or local component.
     */
    dynamicParams: DynamicMFParameters;
    /**
     * Module icon URL.
     */
    iconUrl: string;
    /**
     * Window title.
     */
    title: string;
    /**
     * Optional window subtitle.
     */
    subTitle?: string;
    /**
     * Optional edit-context label displayed in the shell.
     */
    editionInfo?: string;
    /**
     * Window-level options such as cookie persistence controls.
     * TODO: Revisit this after the WindowBase migration.
     */
    windowOptions?: WindowOptions;
    /**
     * Optional parent window identifier.
     */
    parentId?: string;
    /**
     * Opening mode.
     */
    openType?: OpenType;
    /**
     * Reuse key that updates an existing window instead of opening a duplicate.
     */
    replaceMeId?: string;
}
/**
 * Base fields added by the Areas store after a window is created.
 */
export interface AreaWindowBaseProps extends EmmitNewWindowBase {
    areaId: string;
    /**
     * Persisted window identifier. Rehydrated windows can receive this value from storage or the backend.
     */
    windowId: string;
    onClose?: (windowId: string) => void;
    /**
     * Debug-only cookie snapshot used by isolation and local troubleshooting flows.
     */
    devCookies?: Cookies;
}
/**
 * Runtime-managed fields injected by the Areas store after it accepts a launch payload.
 * Emitters must not send these values through the public `NewWindow` contract.
 */
type AreaRuntimeManagedKeys = 'windowId' | 'onClose' | 'areaId';
export interface AreaLayoutBaseProps extends AreaWindowBaseProps {
    emergeType: 'layout';
    layoutProps: Omit<LayoutItem, 'i'>;
}
export interface AreaLayoutMFProps extends AreaLayoutBaseProps {
    winType: 'microfrontend';
    mfProps: MFBaseProps;
}
export interface AreaLayoutComponentProps extends AreaLayoutBaseProps {
    winType: 'component';
    component: JSX_REACT_NODE;
}
export type AreaLayoutProps = AreaLayoutMFProps | AreaLayoutComponentProps;
export type AreaLayoutStateProps = AreaLayoutProps & WindowState;
/**
 * Layout payloads emitted by callers before the Areas store adds runtime state.
 * Keep this derived from the stored layout branches so the omitted runtime-owned
 * fields stay visible in the public contract.
 */
export type EmmitNewLayoutBaseProps = Omit<AreaLayoutBaseProps, AreaRuntimeManagedKeys>;
export type EmmitNewLayoutMFProps = Omit<AreaLayoutMFProps, AreaRuntimeManagedKeys>;
export type EmmitNewLayoutComponentProps = Omit<AreaLayoutComponentProps, AreaRuntimeManagedKeys>;
export type EmmitNewLayoutProps = EmmitNewLayoutMFProps | EmmitNewLayoutComponentProps;
/**
 * Popup-only shell props that do not already travel through the Areas event payload.
 * This intentionally excludes popup store-managed fields such as `popupId`,
 * `groupId`, `dynamicMFStore`, rendered content, and close callbacks.
 * It also preserves the old contract boundary where popup payload authors do
 * not provide shell-owned values such as `title`, `winType`, `mfProps`,
 * `component`, `dynamicParams`, `iconUrl`, `subTitle`, `windowOptions`,
 * `parentLayoutId`, `openType`, `replaceMeId`, `onRemove`, or `parentId`.
 */
type PopupPropsForAdd = Partial<Pick<PopupAddProps, 'bounds' | 'defaultPosition' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'resizable' | 'draggable'>>;
export type Position = {
    x: number;
    y: number;
    width: number;
    height: number;
};
export interface AreaPopupBaseProps extends AreaWindowBaseProps {
    emergeType: 'popup';
    popupProps: PopupPropsForAdd;
    /**
     * Explicit reuse key for popup windows that refresh an existing shell instead of opening a duplicate.
     */
    replaceMeId?: string;
}
export interface AreaPopupMFProps extends AreaPopupBaseProps {
    winType: 'microfrontend';
    mfProps: MFBaseProps;
}
export interface AreaPopupComponentProps extends AreaPopupBaseProps {
    winType: 'component';
    component: JSX_REACT_NODE;
}
export interface EmmitNewPopupMFProps extends EmmitNewWindowBase {
    emergeType: 'popup';
    winType: 'microfrontend';
    mfProps: MFBaseProps;
    popupProps: PopupPropsForAdd;
}
export interface EmmitNewPopupComponentProps extends EmmitNewWindowBase {
    emergeType: 'popup';
    winType: 'component';
    component: JSX_REACT_NODE;
    popupProps: PopupPropsForAdd;
}
export type EmmitNewPopupProps = EmmitNewPopupMFProps | EmmitNewPopupComponentProps;
export interface HashWindowsByLayouts {
    [P: string]: AreaLayoutStateProps;
}
/**
 * Shared panel-shell props regardless of which side owns the emergence.
 */
type AreaPanelBasePropsForAdd = {
    /**
     * Whether the panel should stay docked inside the area flow.
     * Unpinned panels render as overlays.
     */
    pinned?: boolean;
};
/**
 * Horizontal panel props.
 * Left/right panels only accept width-based sizing because they steal or
 * overlay horizontal space inside the work area.
 */
export type AreaHorizontalPanelPropsForAdd = AreaPanelBasePropsForAdd & {
    /**
     * Side of the work area where the panel should appear.
     */
    side: 'left' | 'right';
    /**
     * Preferred panel width for left/right placement.
     */
    width?: number;
    /**
     * Optional width ceiling used by the panel-only resize affordance.
     */
    maxWidth?: number;
    /**
     * Horizontal panels do not expose height-based sizing.
     */
    height?: never;
    /**
     * Horizontal panels do not expose height-based sizing.
     */
    maxHeight?: never;
};
/**
 * Vertical panel props.
 * Top/bottom panels only accept height-based sizing because they steal or
 * overlay vertical space inside the work area.
 */
export type AreaVerticalPanelPropsForAdd = AreaPanelBasePropsForAdd & {
    /**
     * Side of the work area where the panel should appear.
     */
    side: 'top' | 'bottom';
    /**
     * Preferred panel height for top/bottom placement.
     */
    height?: number;
    /**
     * Optional height ceiling used by the panel-only resize affordance.
     */
    maxHeight?: number;
    /**
     * Vertical panels do not expose width-based sizing.
     */
    width?: never;
    /**
     * Vertical panels do not expose width-based sizing.
     */
    maxWidth?: never;
};
/**
 * Panel-specific shell props.
 * Panels can float above the main layout flow or stay pinned inside it.
 */
export type AreaPanelPropsForAdd = AreaHorizontalPanelPropsForAdd | AreaVerticalPanelPropsForAdd;
/**
 * Narrow size updates written back by the panel resize flow.
 * Each branch mirrors the public panel contract so the store only accepts the
 * axis that belongs to the target side.
 */
export type AreaPanelSizeUpdate = Pick<AreaHorizontalPanelPropsForAdd, 'width' | 'maxWidth'> | Pick<AreaVerticalPanelPropsForAdd, 'height' | 'maxHeight'>;
export interface AreaPanelBaseProps extends AreaWindowBaseProps {
    emergeType: 'panel';
    panelProps: AreaPanelPropsForAdd;
}
export interface AreaPanelMFProps extends AreaPanelBaseProps {
    winType: 'microfrontend';
    mfProps: MFBaseProps;
}
export interface AreaPanelComponentProps extends AreaPanelBaseProps {
    winType: 'component';
    component: JSX_REACT_NODE;
}
export type EmmitNewPanelProps = Omit<AreaPanelMFProps, AreaRuntimeManagedKeys> | Omit<AreaPanelComponentProps, AreaRuntimeManagedKeys>;
type AreaModalPropsForAdd = Pick<DOMRect, 'width' | 'height'> & Pick<DragResizeWindowPropsRND, 'minWindowWidth' | 'minWindowHeight'>;
export interface AreaModalBaseProps extends AreaWindowBaseProps {
    emergeType: 'modal';
    zIndex?: number;
    modalProps: AreaModalPropsForAdd;
}
export interface AreaModalMFProps extends AreaModalBaseProps {
    winType: 'microfrontend';
    mfProps: MFBaseProps;
}
export interface AreaModalComponentProps extends AreaModalBaseProps {
    winType: 'component';
    component: JSX_REACT_NODE;
}
export type EmmitNewModalProps = Omit<AreaModalMFProps, AreaRuntimeManagedKeys> | Omit<AreaModalComponentProps, AreaRuntimeManagedKeys>;
export type AreaMFWindowProps = (AreaLayoutMFProps & WindowState) | (AreaPopupMFProps & WindowState) | (AreaPanelMFProps & WindowState) | (AreaModalMFProps & WindowState);
export type AreaComponentWindowProps = (AreaLayoutComponentProps & WindowState) | (AreaPopupComponentProps & WindowState) | (AreaPanelComponentProps & WindowState) | (AreaModalComponentProps & WindowState);
export type AreaWindowProps = AreaMFWindowProps | AreaComponentWindowProps;
export interface HashWindows {
    [P: string]: AreaWindowProps;
}
export type EmmitNewWindowProps = EmmitNewLayoutProps | EmmitNewPopupProps | EmmitNewPanelProps | EmmitNewModalProps;
export type AddWindow = (newWindow: EmmitNewWindowProps) => string;
export {};
//# sourceMappingURL=types.d.ts.map