import { ContextAny, ContextMap, InteropRaiseIntent, InteropOpenRequest, AuthenticationToken, PrivateChannelEventSubscriptionType, InteropJoinChannels } from "../../../clients/Interop/types";
import { ActionId } from "../../../common/redux/types";
import { WindowDescriptor, SpawnParams, ConnectId } from "../window/types";
import { PayloadAction } from "@reduxjs/toolkit";
import { OpenError, ChannelError, ContextType, DisplayMetadata, AppIntent, IntentMetadata, ResolveError, AppMetadata, AppIdentifier } from "@finos/fdc3";
export * from "./modules/types";
export declare const CLEANUP_INTERVAL: number;
export declare const BRIDGING_CHECK_CONNECTION_INTERVAL: number;
/**
 * This type is used internally by the broadcast action. It can
 * handle either an intent or a context.
 *
 * It supports necessary internal features that are not possible
 * through the desktop agent.
 */
export type InteropBroadcastInternal = {
    type: "broadcast" | "raiseIntent";
    payload: {
        context?: ContextAny;
        intent?: string | null;
        target?: AppIdentifier | String;
        requestId?: string;
    };
    meta: {
        uuid: string;
        appId?: string;
        channel?: string;
        to?: string;
        noSelectConnect?: boolean;
        setSenderContext?: boolean;
        pendingActionId?: ActionId;
        autoBroadcast?: boolean;
        targetSubscriberId?: string;
    };
};
export type RaiseIntentActionResult = {
    type: InteropRaiseIntent["type"];
    result: {
        source: AppMetadata;
        intent: string;
        version?: string;
    };
    error?: ResolveError;
};
export type OpenActionResult = {
    type: InteropOpenRequest["type"];
    openedAppIdentifier?: AppIdentifier;
    error?: OpenError;
};
export type JoinActionResult = {
    type: InteropJoinChannels["type"];
    error?: ChannelError;
};
export type InteropMessageWithActonId<T> = {
    fsa: T;
    actionId: ActionId;
};
export type SelectConnectAppList = {
    appId: string;
};
export type AutoAssociateRule = {
    allChildren?: boolean;
    selectChildren?: string[];
    usingConnectId?: string;
};
export type SelectConnectRule = {
    cc?: any;
    fwd?: any;
    to?: SelectConnectAppList[];
    from?: SelectConnectAppList[];
    authorize?: SelectConnectAppList[];
    contextType?: string;
    intentType?: string;
    autoAssociate?: AutoAssociateRule;
};
export type InteropConfig = {
    intents?: [
        {
            name: string;
            displayName: string;
            contexts?: [string];
        }
    ];
    channels?: {
        system?: Record<string, true>;
        private?: Record<string, true>;
    };
    selectConnect?: SelectConnectRule[];
    useLinker?: boolean;
};
/**
 * The cross-section of Finsemble's config (AppD manifest) that is specific
 * to interop.
 */
export interface AppConfig {
    interop?: InteropConfig;
    signatureKey?: JsonWebKey;
    signatureKeyURL?: string;
}
/**
 * OutgoingMessage's are sent back to subscribing FDC3 clients as the result of a broadcast or intent.
 */
export type OutgoingMessage = {
    uuid: string;
    senderUuid: string;
    senderAppId?: string;
    channel?: string;
    context?: ContextAny;
    intent?: string;
    requestId?: string;
    pendingActionId?: ActionId;
    routerChannel: string;
    targetSubscriberId?: string;
};
/**
 * OutgoingDispatchMessage's trigger redux actions, based on SelectConnect rules resulting from a broadcast.
 *
 * uuid is either the uuid of the broadcaster or the destination depending on whether the triggered rule
 * was broadcast or destination side (if both then there will be two outgoing messages)
 */
export type OutgoingDispatchMessage = {
    fsa: InteropBroadcastInternal;
    uuid: string;
} & IntentOrContextType;
/**
 * OutgoingSelectConnectChannelMessage's are sent to registered SelectConnect channels from remote apps based on results from a broadcast that target those channels.
 *
 * uuid is either the uuid of the broadcaster or the destination depending on whether the triggered rule
 * was broadcast or destination side (if both then there will be two outgoing messages)
 */
export type OutgoingSelectConnectChannelMessage = {
    routerChannel: string;
    fsa: InteropBroadcastInternal;
    uuid: string;
} & IntentOrContextType;
export type IntentOrContextType = {
    intent?: string;
    contextType?: string;
    context?: ContextAny;
};
export type ClientDestination = {
    type: "client";
    uuid: string;
    channel?: string;
    routerChannel: string;
    requestId?: string;
} & IntentOrContextType;
/**
 * uuid is either the uuid of the broadcaster or the destination depending on whether the triggered rule
 * was broadcast or destination side (if both then there will be two outgoing messages)
 */
export type ConnectDestination = {
    type: "selectConnect";
    name: string;
    uuid: string;
} & IntentOrContextType;
export type Destination = ClientDestination | ConnectDestination;
export type RegisterSelectConnectChannel = {
    name: string;
} & ({
    dispatchAction: string;
} | {
    routerChannel: string;
});
export type SignatureKey = any;
/**
 * See finsemble.scheme.json for full config
 */
export type FinsembleComponentConfig = {
    bootParams?: Record<string, any>;
    signatureKey?: SignatureKey;
    window?: SpawnParams;
    foreign?: {
        agentLabel?: string;
        clients?: {
            dialogManager?: {
                isDialog?: boolean;
            };
        };
        services?: {
            windowService?: {
                global?: boolean;
                allowSnapping?: boolean;
                allowGrouping?: boolean;
                allowAutoArrange?: boolean;
                allowTabbing?: boolean;
                allowTiling?: boolean;
                allowMinimize?: boolean;
                allowMaximize?: boolean;
                shouldRegister?: boolean;
                manageWindowMovement?: boolean;
            };
            workspaceService?: {
                persistURL?: boolean;
                persistPath?: boolean;
                persistArguments?: boolean;
            };
        };
        components?: {
            "App Launcher"?: {
                launchableByUser?: boolean;
            };
            Toolbar?: {
                iconClass?: string;
                iconURL?: string;
            };
            "Window Manager"?: {
                alwaysOnTopIcon?: boolean;
                cloneIcon?: boolean;
                titlebarType?: "browserview" | "injected";
                FSBLHeader?: boolean | {
                    hideMaximize?: boolean;
                    hideMinimize?: boolean;
                    hideClose?: boolean;
                    persistWindowState?: boolean;
                    zoomDefault?: number;
                    hackScrollbar?: boolean;
                };
                floatingTitlebarComponent?: string;
                deliveryMechanism?: "injection" | "preload";
                zoom?: {
                    timeout?: number;
                    step?: number;
                    max?: number;
                    min?: number;
                };
                componentCloseTimeout?: number;
            };
        };
        custom?: any;
    };
    isAnApp?: boolean;
    interop?: {
        useLinker?: boolean;
        autoConnect?: boolean;
        joinMultipleChannels?: boolean;
        fdc3_1_2_compatibility?: boolean;
        showWhenIntentReceived?: boolean;
        selectConnect?: SelectConnectRule[];
    };
    component?: {
        category?: string;
        mode?: string;
        advertiseReceivers?: string | string[];
        spawnOnStartup?: boolean;
        spawnOnAllMonitors?: boolean;
        useAppCatalog?: boolean;
        singleton?: boolean;
        showDevConsoleOnVisible?: boolean;
        allowQuickComponent?: string;
        neededClients?: string[];
        displayName?: string;
        centralLoggerNamePrefix?: string;
        preload?: boolean | string | string[];
        spawnOnHotkey?: string[];
        reloadTimeout?: number;
        maxReloadAttempts?: number;
        window?: any;
        custom?: any;
    };
    childWindowOptions?: Record<string, any>;
    custom?: Record<string, any>;
};
export type AppDIcon = {
    src: string;
    sizes?: string;
    type?: string;
};
export type FDC3Icon = {
    src: string;
    size?: string;
    type?: string;
};
export type FDC3Screenshot = FDC3Icon & {
    label?: string;
};
export type FDC3AppPreviousDefinition = {
    appId: string;
    name: string;
    type: string;
    title?: string;
    description?: string;
    manifest?: FinsembleComponentConfig & {
        [index: string]: any;
    };
    manifestType?: string;
    version?: string;
    releaseNotes?: string;
    tooltip?: string;
    images?: AppDIcon[];
    tags?: string[];
    contactEmail?: string;
    supportEmail?: string;
    publisher?: string;
    icons?: AppDIcon[];
    intents?: {
        name: string;
        displayName: string;
        contexts?: string[];
        appListenerAdded?: boolean;
    }[];
    interop: any;
};
export type FDC3AppIntents = {
    listensFor?: Record<string, {
        displayName: string;
        contexts?: string[];
        resultType?: string;
        appListenerAdded?: boolean;
    }>;
    raises?: Record<string, string[]>;
};
export type FDC3AppDefinition = {
    appId: string;
    name?: string;
    type: string;
    title?: string;
    description?: string;
    categories?: string[];
    hostManifests?: {
        Finsemble?: FinsembleComponentConfig & {
            [index: string]: any;
        };
    };
    details?: {
        url?: string;
        path?: string;
        alias?: string;
        arguments?: string[];
    };
    version?: string;
    tooltip?: string;
    tags?: string[];
    lang?: "en-US";
    contactEmail?: string;
    supportEmail?: string;
    publisher?: string;
    icons?: FDC3Icon[];
    screenshots?: FDC3Screenshot[];
    interop?: {
        intents?: FDC3AppIntents;
    };
};
export type AppDefinitionMetadata = {
    retrievedAt: string;
    appDUrl: string;
    autoUpdate?: boolean;
    serverDisplayName?: string;
};
export interface AppDefinition extends FDC3AppDefinition {
    firstRegistrationTimestamp?: number;
    verified?: boolean;
    metadata?: AppDefinitionMetadata;
}
export type WindowInteropPersistedData = {
    connectId?: ConnectId;
    connectIdParentWindow?: string;
};
export type InteropClient = {
    readiness: "initializing" | "ready";
    heartbeatTime: number;
    authenticated: boolean;
    authenticatedTransport: object;
    uuid: string;
    windowName: string;
    appName: string;
    appId: string;
    routerChannel: string;
    config?: AppConfig;
    channels: string[];
    connectId?: ConnectId;
    savedUIResolverChoices?: Record<string, Record<string, string>>;
    joinedChannels: string[];
    mostRecentContext?: ContextAny;
    subscriptions: {
        globals: {
            contexts: {
                [contextType: string]: CurrentContext;
            };
            intents: {
                [intent: string]: ContextType | true;
            };
        };
        channels: {
            [channel: string]: {
                contexts: {
                    [contextType: string]: CurrentContext;
                };
                intents: {
                    [intent: string]: ContextType | true;
                };
            };
        };
    };
};
export interface InternalAppDServerMetadata {
    url: string;
    displayName: string;
    iconURL?: string;
}
export type LoopDetectionEntry = {
    timestamp: number;
    count: number;
    loopNotificationIssued: boolean;
    timerId?: ReturnType<typeof setTimeout>;
};
export type CurrentContext = {
    context: ContextAny;
    meta: {
        timestamp: number;
        targetSubscriberId?: string;
    };
};
export declare const EmptyCurrentContext: {
    context: {
        type: string;
    };
    meta: {
        timestamp: number;
        targetSubscriberId: undefined;
    };
};
export type LinkerClient = {
    connectId?: ConnectId;
    connectIdParentWindow?: string;
    connectIdChannel?: string;
    modifiedConnectIdChannel?: string;
    spawnedFromWorkspace?: boolean;
    joinedChannels: string[];
};
export type LinkerChannel = {
    name: string;
    color: string;
    cssClassName: string;
    label: string;
};
export type InteropRegistrationData = {
    authenticationToken: AuthenticationToken;
    windowDescriptor: WindowDescriptor;
};
export type InteropStore = {
    linker: {
        clients: {
            [windowName: string]: LinkerClient;
        };
        allChannels: LinkerChannel[];
        connectIdToJoinedChannel: Record<string, string>;
        activeWindowName?: string;
        pendingToRemove: Record<string, LinkerClient>;
    };
    workspace: {
        persistedData: {
            [windowName: string]: Record<string, ContextAny>;
        };
    };
    bridging: {
        readiness: "unconnected" | "connecting" | "active";
        loopbackEnable: boolean;
        desktopAgentBridgingName: string;
        privateChannelRemoteOrigin: Record<string, any>;
        privateChannelRemoteListeners: Record<string, any>;
        remoteEventListenerForOnAddContextListener: Record<string, any>;
        remoteEventListenerForOnUnsubscribe: Record<string, any>;
        remoteEventListenerForOnDisconnect: Record<string, any>;
    };
    main: {
        pendingInteropRegistrationData: WindowDescriptor[];
        pendingOpenActionIds: {
            [windowName: string]: ActionId;
        };
        config: {
            serverUUID: string;
            registeredUIResolver: string | null;
        };
        clients: {
            [uuid: string]: InteropClient;
        };
        selectConnectChannels: {
            [name: string]: {
                name: string;
                dispatchAction: string;
            } | {
                name: string;
                routerChannel: string;
            };
        };
        privateChannelEventSubscriptions: {
            subscribeType: PrivateChannelEventSubscriptionType;
            channel: string;
            targetSubscriberId: string;
            uuid: string;
        }[];
        channelMeta: {
            [id: string]: {
                type: string;
                displayMetaData?: DisplayMetadata;
            };
        };
        lastChannelState: {
            [channel: string]: {
                context: ContextAny;
                senderUuid: string;
            };
        };
        lastChannelStateByType: {
            [channel: string]: ContextMap;
        };
        uuidByRequestId: {
            [requestId: string]: string;
        };
        isBridgedByRequestId: {
            [requestId: string]: boolean;
        };
        requestIdTimestamp: {
            [requestId: string]: number;
        };
        apps: {
            definitions: {
                [appId: string]: AppDefinition;
            };
            intentResolutionInProgress: boolean;
            intentResolutionCurrentActionId: any;
        };
        contextTypes: {
            [contextType: string]: {
                launchableHandlers: {
                    [appId: string]: true;
                };
                intents: {
                    launchable: AppIntent[];
                    live: AppIntent[];
                };
            };
        };
        intents: {
            [intent: string]: {
                info: IntentMetadata;
                launchableHandlers: {
                    [appId: string]: {
                        contexts?: ContextType[];
                        resultType?: string;
                    } | null;
                };
            };
        };
        queue: {
            [uuidOrWindowName: string]: {
                pendingMessage: InteropBroadcastInternal;
                timestamp: number;
                handlerIsReady?: boolean;
            }[];
        };
        loopDetectionMap: {
            [uuid: string]: LoopDetectionEntry;
        };
        addIntentListenerMaxInitializationTimeout: number;
        joinMultipleChannelsFlag: boolean;
        fdc3_1_2_compatibility: boolean;
    };
    root: {
        isVisible: boolean;
        heartbeats: boolean;
        testing: {
            unitTestingEnabled: boolean;
            messagesToSend: OutgoingMessage[];
            dispatchesToSend: PayloadAction<OutgoingDispatchMessage>[];
            selectConnectChannelMessagesToSend: OutgoingSelectConnectChannelMessage[];
            destinationsBeforeSelectConnect: Destination[];
            triggeredRules: {
                rulePhase: string;
                result: string;
                rule: any;
                uuid: string;
                destination: Destination;
            }[];
            error: string;
        };
    };
    "@@cmds"?: any[];
};
export type ResolverStore = InteropStore["main"];
export type ResolverApps = InteropStore["main"]["apps"];
export type ResolverClients = InteropStore["main"]["clients"];
export type ResolverAppsDefinition = InteropStore["main"]["apps"]["definitions"];
export type ResolverIntentsData = InteropStore["main"]["intents"];
export type ResolverIntent = InteropStore["main"]["intents"]["intent"];
export type ResolverChannelMeta = InteropStore["main"]["channelMeta"];
export type ResolverPrivateChannelEventSubscriptions = InteropStore["main"]["privateChannelEventSubscriptions"];
export type LinkerStore = InteropStore["linker"];
export type RootStore = InteropStore["root"];
export type WorkspaceStore = InteropStore["workspace"];
export type BridgingStore = InteropStore["bridging"];
export type SelectConnectChannel = ResolverStore["selectConnectChannels"][""];
export type LoopDetectionMap = InteropStore["main"]["loopDetectionMap"];
export type ClientAdded = {
    uuid: string;
    config: AppConfig;
    windowName: string;
    appId: string;
    connectId?: ConnectId;
    connectIdParentWindow?: string;
    spawnedFromWorkspace?: boolean;
};
export type ClientRemoved = {
    uuid: string;
    windowName: string;
};
export type DIAM = {
    appId?: string;
    name?: string;
    domain?: string;
    executable?: string;
};
export type RegistrationResult = {
    config: AppConfig;
    authenticated: boolean;
    appId: string;
    appName: string;
    windowName: string;
    uuid: string;
    newPendingInteropRegistrationData?: InteropRegistrationData[];
    connectId?: ConnectId;
    connectIdParentWindow?: string;
    spawnedFromWorkspace?: boolean;
    actionId: ActionId;
    savedUIResolverChoices?: Record<string, Record<string, string>>;
};
export type AuthCryptoKeyPair = {
    privateJWKey: JsonWebKey;
    publicJWKey: JsonWebKey;
};
export type AuthSignatureData = {
    timestamp: number;
};
//# sourceMappingURL=types.d.ts.map