import { z } from 'zod';
import type { DatabaseMetadata, CredentialOptions, DependencyGraphNode, BubbleOperationResult, BubbleResult, ExecutionMeta } from '@bubblelab/shared-schemas';
import type { BubbleLogger } from '../logging/BubbleLogger';
export interface IBubble<TResult extends BubbleOperationResult = BubbleOperationResult> {
    readonly name: string;
    readonly schema: z.ZodObject<z.ZodRawShape>;
    readonly resultSchema: z.ZodObject<z.ZodRawShape>;
    readonly shortDescription: string;
    readonly longDescription: string;
    readonly alias?: string;
    readonly type: 'service' | 'workflow' | 'tool' | 'ui' | 'infra';
    previousResult: BubbleResult<BubbleOperationResult> | undefined;
    action: () => Promise<BubbleResult<TResult>>;
    saveResult: <R extends BubbleOperationResult>(result: BubbleResult<R>) => void;
    clearSavedResult: () => void;
    generateMockResult: () => BubbleResult<TResult>;
    generateMockResultWithSeed: (seed: number) => BubbleResult<TResult>;
}
export interface IServiceBubble<TParams extends Record<string, unknown> = Record<string, unknown>, TResult extends BubbleOperationResult = BubbleOperationResult> extends IBubble<TResult> {
    readonly type: 'service';
    authType?: 'oauth' | 'apikey' | 'none' | 'connection-string';
    testCredential: () => Promise<boolean>;
    setParam: <K extends keyof TParams>(paramName: K, paramValue: TParams[K]) => void;
    getCredentialMetadata: () => Promise<DatabaseMetadata | undefined>;
}
export interface IWorkflowBubble<TResult extends BubbleOperationResult = BubbleOperationResult> extends IBubble<TResult> {
    readonly type: 'workflow';
}
export interface IToolBubble<TResult extends BubbleOperationResult = BubbleOperationResult> extends IBubble<TResult> {
    readonly type: 'tool';
}
export interface IUIBubble extends IBubble {
    readonly type: 'ui';
    template: string;
}
export interface IInfraBubble extends IBubble {
    readonly type: 'infra';
    provider: 'aws' | 'gcp' | 'supabase';
    resourceType: string;
}
export type BubbleFlowOperationResult = unknown;
export interface BubbleContext {
    logger?: BubbleLogger;
    variableId?: number;
    invocationCallSiteKey?: string;
    /**
     * Dependency graph for the current bubble flow, used to deduce child variable IDs.
     */
    dependencyGraph?: DependencyGraphNode;
    /**
     * The unique hierarchical id of the current bubble within the dependency graph.
     * Root is typically something like `${bubbleName}#1`.
     */
    currentUniqueId?: string;
    /**
     * Internal usage counters keyed by `${currentUniqueId||'ROOT'}|${childName}` to derive next ordinal.
     */
    __uniqueIdCounters__?: Record<string, number>;
    executionMeta?: ExecutionMeta;
    [key: string]: unknown;
}
export type ServiceBubbleParams<T = unknown> = T & {
    credentials?: CredentialOptions;
    retries?: number;
};
//# sourceMappingURL=bubble.d.ts.map