import { Context, TargetApp, AppIntent, OpenError, IntentResolution, ResolveError, ContextType, AppMetadata } from "../../typedefs/FDC3";
import { AppDefinition } from "../../services/Interop/types";
export declare type Member<T, K extends keyof T> = T[K];
export declare type MultiMap<T> = Record<string, Array<T>>;
/**
 * MultiMap add
 * @param records
 * @param index
 * @param handler
 */
export declare const mmAdd: (records: MultiMap<any>, index: string, handler: any) => any[];
/**
 * Concats an item to an array, eliminating any dups, and creating the array if it is null or undefined
 * @param arr
 * @param item
 */
export declare const concatNoDups: (arr: any[] | undefined, item: any | any[]) => any[];
/**
 * MultiMap remove
 * @param records
 * @param index
 * @param handler
 */
export declare const mmRemove: (records: MultiMap<any>, index: string, handler: any) => any[];
export declare const errorAsString: (err: any) => string;
export declare const GLOBAL_CHANNEL = "global";
export declare const SERVER_CHANNEL = "FSBL.FDC3.Interop.Server";
export declare const INTENT_RESOLVER_CHANNEL = "FSBL.FDC3.intent.resolver";
export declare type ResolutionCandidate = {
    meta: AppMetadata;
    appId: string;
    uuid?: string;
    windowName?: string;
};
/**
 * A list of intent resolutions that are possible for a given intent and optional context.
 *
 * Arrays of Resolutionlist's are used in raiseIntent to deal with the raiseIntentByContext, which might result
 * in several resolution lists (one list for each possible intent that is associated with the requested context).
 *
 * For instance, raiseIntentByContext({"symbol" : "IBM"}) could result in:
 * contetType("symbol") => intent("Quote") => QuotesApp, RFQApp, ...
 * contetType("symbol") => intent("News") => NewsApp, TwitterApp, ...
 * contetType("symbol") => intent("Chart") => ChartApp, SnapshotChartApp, ...
 */
export declare type ResolutionList = {
    intent: {
        name: string;
        displayName: string;
    };
    launchableApps: ResolutionCandidate[];
    openApps: ResolutionCandidate[];
    context?: ContextAny;
};
export declare type IntentTargetList = {
    resolutionList: ResolutionList[];
    originatingAppName?: string;
};
export declare type ResolverResolution = {
    intent?: string;
    selectedApp?: AppMetadata;
    windowName?: string;
    error?: ResolveError;
};
export declare type AuthenticationToken = {
    signatureString: string;
    signatureStringType: "dynamic" | "static" | "unauthenticated";
    meta: AppMetadata;
    timestamp?: number;
};
export declare const AnonymousAuthenticationToken: AuthenticationToken;
export declare type IntentResolverHandler = (choices: IntentTargetList) => Promise<ResolverResolution>;
export declare type ContextAny = Context & {
    [data: string]: any;
};
export declare type ContextMap = {
    [contextType: string]: {
        context: ContextAny;
        senderUuid: string;
    };
};
/**
 * The following are the Flux Standard Actions (FSA) that are exchanged between the Desktop Agent
 * and the Interop Server.
 */
export declare type InteropMeta = {
    uuid: string;
    href?: string;
    path?: string;
    authenticatedTransport?: object;
};
export declare type InteropRegister = {
    type: "register";
    payload: {
        authenticationToken: AuthenticationToken;
        clientChannel: string;
        windowName: string;
    };
    meta: InteropMeta;
};
export declare type InteropHeartbeat = {
    type: "heartbeat";
    meta: InteropMeta;
};
export declare type InteropUnregister = {
    type: "unregister";
    meta: InteropMeta;
};
export declare type InteropBroadcast = {
    type: "broadcast";
    payload: {
        context: ContextAny;
    };
    meta: InteropMeta & {
        channel?: string;
        targetSubscriberId?: string;
    };
};
export declare type InteropSystemChannels = {
    type: "systemChannels";
    payload: {
        channels: string[];
    };
    meta: InteropMeta;
};
export declare type InteropSystemChannelRequest = {
    type: "systemChannelRequest";
    meta: InteropMeta;
};
export declare type InteropCurrentContextRequest = {
    type: "currentContextRequest";
    payload: {
        contextType?: string;
    };
    meta: InteropMeta & {
        channel?: string;
    };
};
export declare type InteropCurrentContext = {
    type: "currentContext";
    payload: {
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropOpenRequest = {
    type: "open";
    payload: {
        target: TargetApp;
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropGetSystemChannels = {
    type: "open";
    payload: {
        target: TargetApp;
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropOpenResponse = {
    type: "openResponse";
    payload: {
        error?: OpenError;
    };
    meta?: InteropMeta;
};
export declare type InteropFindIntentRequest = {
    type: "findIntent";
    payload: {
        intent: string;
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropFindIntentResponse = {
    type: "findIntentResponse";
    payload: {
        appIntent?: AppIntent;
        error?: ResolveError | null;
    };
    meta: InteropMeta;
};
export declare type InteropFindIntentsByContext = {
    type: "findIntentsByContext";
    payload: {
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropIntentsList = {
    type: "intentsList";
    payload: {
        error?: ResolveError | null;
        intents: AppIntent[];
    };
    meta: InteropMeta;
};
export declare type InteropIntent = {
    type: "intent";
    payload: {
        intent: string;
        context?: Context;
    };
    meta: InteropMeta;
};
export declare type InteropRaiseIntent = {
    type: "raiseIntent";
    payload: {
        intent?: string;
        context?: Context;
        target?: TargetApp;
    };
    meta: InteropMeta;
};
export declare type InteropRaiseIntentResponse = {
    type: "intentResolution";
    payload: {
        error?: ResolveError | null;
        data?: IntentResolution;
    };
    meta?: InteropMeta;
};
export declare type InteropSubscribeContext = {
    type: "subscribeContext";
    payload: {
        contextType: ContextType;
    };
    meta: InteropMeta & {
        channel?: string;
        targetSubscriberId?: string;
    };
};
export declare type InteropUnsubscribeContext = {
    type: "unsubscribeContext";
    payload: {
        contextType?: ContextType;
    };
    meta: InteropMeta & {
        channel?: string;
    };
};
export declare type InteropSubscribeIntent = {
    type: "subscribeIntent";
    payload: {
        intent: string;
    };
    meta: InteropMeta;
};
export declare type InteropUnsubscribeIntent = {
    type: "unsubscribeIntent";
    payload: {
        intent: string;
    };
    meta: InteropMeta;
};
export declare type InteropJoinChannels = {
    type: "joinChannels";
    payload: {
        channels: string[];
    };
    meta: InteropMeta;
};
/**
 * If payload.channnels is omitted then *all* joined channels are removed.
 */
export declare type InteropLeaveChannels = {
    type: "leaveChannels";
    payload: {
        channels?: string[];
    };
    meta: InteropMeta;
};
export declare type InteropAddAppDefinitions = {
    type: "addAppDefinitions";
    payload: {
        apps: {
            [appName: string]: AppDefinition;
        };
    };
    meta: InteropMeta;
};
export declare type InteropRemoveAppDefinitions = {
    type: "removeAppDefinitions";
    payload: {
        apps: string[];
    };
    meta: InteropMeta;
};
export declare type InteropRegisterUIResolver = {
    type: "registerUIResolver";
    meta: InteropMeta;
};
export declare type InteropGetCurrentChannels = {
    type: "getCurrentChannels";
    meta: InteropMeta;
};
export declare type InteropGetCurrentChannelsResponse = {
    type: "interopGetCurrentChannelsResponse";
    payload: {
        error?: string;
        data?: {
            channel: string;
        }[];
    };
    meta?: InteropMeta;
};
export declare type InteropSetAuthenticationToken = {
    type: "setAuthenticationToken";
    payload: {
        authenticationToken: AuthenticationToken;
    };
    meta: InteropMeta;
};
export declare type InteropMessage = InteropRegister | InteropUnregister | InteropBroadcast | InteropSystemChannels | InteropSystemChannelRequest | InteropCurrentContextRequest | InteropCurrentContext | InteropOpenRequest | InteropOpenResponse | InteropFindIntentRequest | InteropFindIntentResponse | InteropFindIntentsByContext | InteropHeartbeat | InteropIntent | InteropIntentsList | InteropJoinChannels | InteropLeaveChannels | InteropRaiseIntent | InteropRaiseIntentResponse | InteropSubscribeContext | InteropUnsubscribeContext | InteropSubscribeIntent | InteropUnsubscribeIntent | InteropAddAppDefinitions | InteropRemoveAppDefinitions | InteropGetCurrentChannels | InteropGetCurrentChannelsResponse | InteropRegisterUIResolver | InteropSetAuthenticationToken;
export declare type InteropType = Member<InteropMessage, "type">;
//# sourceMappingURL=types.d.ts.map