import type { z } from "zod";
import type { L0Options, L0Result } from "./l0";
import type { StructuredOptions, StructuredResult } from "./structured";
export interface PipelineStep<TInput = any, TOutput = any> {
    name: string;
    fn: (input: TInput, context: StepContext) => L0Options | Promise<L0Options>;
    transform?: (result: L0Result, context: StepContext) => TOutput | Promise<TOutput>;
    condition?: (input: TInput, context: StepContext) => boolean | Promise<boolean>;
    onError?: (error: Error, context: StepContext) => void | Promise<void>;
    onComplete?: (result: StepResult<TOutput>, context: StepContext) => void | Promise<void>;
    metadata?: Record<string, any>;
}
export interface StructuredPipelineStep<TInput = any, TSchema extends z.ZodTypeAny = z.ZodTypeAny> {
    name: string;
    fn: (input: TInput, context: StepContext) => StructuredOptions<TSchema> | Promise<StructuredOptions<TSchema>>;
    transform?: (result: StructuredResult<z.infer<TSchema>>, context: StepContext) => any | Promise<any>;
    condition?: (input: TInput, context: StepContext) => boolean | Promise<boolean>;
    onError?: (error: Error, context: StepContext) => void | Promise<void>;
    onComplete?: (result: StructuredStepResult<z.infer<TSchema>>, context: StepContext) => void | Promise<void>;
    metadata?: Record<string, any>;
}
export interface StepContext {
    stepIndex: number;
    totalSteps: number;
    previousResults: StepResult[];
    metadata: Record<string, any>;
    signal?: AbortSignal;
}
export interface StepResult<TOutput = any> {
    stepName: string;
    stepIndex: number;
    input: any;
    output: TOutput;
    l0Result: L0Result;
    status: "success" | "error" | "skipped";
    error?: Error;
    duration: number;
    startTime: number;
    endTime: number;
}
export interface StructuredStepResult<TOutput = any> {
    stepName: string;
    stepIndex: number;
    input: any;
    output: TOutput;
    structuredResult: StructuredResult<TOutput>;
    status: "success" | "error" | "skipped";
    error?: Error;
    duration: number;
    startTime: number;
    endTime: number;
}
export interface PipelineOptions {
    name?: string;
    stopOnError?: boolean;
    timeout?: number;
    signal?: AbortSignal;
    monitoring?: {
        enabled?: boolean;
        metadata?: Record<string, any>;
    };
    onStart?: (input: any) => void | Promise<void>;
    onComplete?: (result: PipelineResult) => void | Promise<void>;
    onError?: (error: Error, stepIndex: number) => void | Promise<void>;
    onProgress?: (stepIndex: number, totalSteps: number) => void | Promise<void>;
    metadata?: Record<string, any>;
}
export interface PipelineResult<TOutput = any> {
    name?: string;
    output: TOutput;
    steps: StepResult[];
    status: "success" | "error" | "partial";
    error?: Error;
    duration: number;
    startTime: number;
    endTime: number;
    metadata?: Record<string, any>;
}
export interface Pipeline<TInput = any, TOutput = any> {
    name?: string;
    steps: PipelineStep[];
    options: PipelineOptions;
    run(input: TInput): Promise<PipelineResult<TOutput>>;
    addStep(step: PipelineStep): Pipeline<TInput, TOutput>;
    removeStep(name: string): Pipeline<TInput, TOutput>;
    getStep(name: string): PipelineStep | undefined;
    clone(): Pipeline<TInput, TOutput>;
}
export interface PipelineBranch<TInput = any> {
    condition: (input: TInput, context: StepContext) => boolean | Promise<boolean>;
    steps: PipelineStep[];
    name?: string;
}
export interface StepBuilderOptions {
    l0Options?: Partial<L0Options>;
    transform?: (result: L0Result) => any | Promise<any>;
    condition?: (input: any, context: StepContext) => boolean | Promise<boolean>;
    onError?: (error: Error, context: StepContext) => void | Promise<void>;
    metadata?: Record<string, any>;
}
export interface PipelinePreset {
    name: string;
    stopOnError: boolean;
    timeout?: number;
    monitoring?: {
        enabled: boolean;
    };
}
export declare const fastPipeline: Partial<PipelineOptions>;
export declare const reliablePipeline: Partial<PipelineOptions>;
export declare const productionPipeline: Partial<PipelineOptions>;
//# sourceMappingURL=pipeline.d.ts.map