import { type Message as CMessage } from '@botpress/client';
import { z } from '@botpress/sdk';
import { BotClient } from '@botpress/sdk/dist/bot';
import type { ChannelSpec, Channels } from '../_types/channels';
import type { ConversationDefinitions } from '../_types/conversations';
import { WorkflowDefinitions } from '../_types/workflows';
import { Autonomous } from '../runtime/autonomous';
import { WorkflowCallbackEventType } from '../runtime/events';
import { ZuiType } from '../types';
import { BaseConversationInstance } from './conversation-instance';
import { Definitions } from './definition';
import { BaseWorkflowInstance } from './workflow-instance';
type WorkflowRequest = {
    [WfName in keyof WorkflowDefinitions & string]: keyof WorkflowDefinitions[WfName]['requests'] extends never ? never : {
        [ReqName in keyof WorkflowDefinitions[WfName]['requests'] & string]: {
            type: `${WfName}:${ReqName}`;
            workflow: BaseWorkflowInstance<WfName>;
            step: string;
        };
    }[keyof WorkflowDefinitions[WfName]['requests'] & string];
}[keyof WorkflowDefinitions & string];
export declare namespace Typings {
    type Message<TChannel extends keyof ConversationDefinitions = keyof ConversationDefinitions, TType extends keyof ConversationDefinitions[TChannel]['messages'] = keyof ConversationDefinitions[TChannel]['messages']> = TChannel extends keyof ConversationDefinitions ? TType extends keyof ConversationDefinitions[TChannel]['messages'] ? Omit<CMessage, 'type' | 'tags' | 'payload'> & {
        type: TType;
        payload: ConversationDefinitions[TChannel]['messages'][TType];
        tags: ConversationDefinitions[TChannel]['messageTags'];
    } : never : never;
    type Event<TChannel extends keyof ConversationDefinitions = keyof ConversationDefinitions> = TChannel extends keyof ConversationDefinitions ? {
        [EType in keyof ConversationDefinitions[TChannel]['events']]: {
            type: EType;
            payload: ConversationDefinitions[TChannel]['events'][EType];
        };
    }[keyof ConversationDefinitions[TChannel]['events'] & (string | number)] | WorkflowCallbackEventType : never;
    type ExtractChannel<T extends ChannelSpec> = T extends readonly string[] ? T[number] : T extends '*' ? Channels : T;
    type HandlerProps<TChannelSpec extends ChannelSpec = ChannelSpec, State extends ZuiType = ZuiType, Channel extends string = ExtractChannel<TChannelSpec>> = Channel extends keyof ConversationDefinitions ? {
        type: 'message';
        channel: Channel;
        conversation: BaseConversationInstance<Channel>;
        message: Message<Channel>;
        event?: never;
        workflow?: never;
        request?: never;
        state: z.infer<State>;
        client: BotClient<any>;
        execute: Autonomous.ConvoExecuteFn;
    } | {
        type: 'event';
        channel: Channel;
        conversation: BaseConversationInstance<Channel>;
        event: Event<Channel>;
        message?: never;
        workflow?: never;
        request?: never;
        state: z.infer<State>;
        client: BotClient<any>;
        execute: Autonomous.ConvoExecuteFn;
    } | {
        type: 'workflow_request';
        channel: Channel;
        conversation: BaseConversationInstance<Channel>;
        event?: never;
        message?: never;
        workflow?: never;
        request: WorkflowRequest;
        state: z.infer<State>;
        client: BotClient<any>;
        execute: Autonomous.ConvoExecuteFn;
    } : never;
    type Handler<TChannelSpec extends ChannelSpec = ChannelSpec, State extends ZuiType = ZuiType> = (props: HandlerProps<TChannelSpec, State>) => Promise<void> | void;
    type StartFromTrigger<State extends ZuiType = ZuiType> = (event: any) => Promise<string | false> | string | false;
    type Props<TChannelSpec extends ChannelSpec = ChannelSpec, State extends ZuiType = ZuiType> = {
        channel: TChannelSpec;
        handler: Handler<TChannelSpec, State>;
        state?: State;
        startFromTrigger?: StartFromTrigger<State>;
    };
    const Primitive: "conversation";
}
/**
 * Base Conversation definition class.
 * This defines a conversation handler for one or more channels.
 * At runtime, it will be instantiated as a BaseConversationInstance.
 *
 * The generated Conversation class in runtime.d.ts provides proper typing.
 */
export declare class BaseConversation<TChannelSpec extends ChannelSpec = ChannelSpec, State extends ZuiType = ZuiType> implements Definitions.Primitive {
    #private;
    readonly channel: ChannelSpec;
    constructor(props: Typings.Props<TChannelSpec, State>);
}
export {};
//# sourceMappingURL=conversation.d.ts.map