/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
export type FlowSurfaceErrorType = 'bad_request' | 'forbidden' | 'conflict' | 'internal_error';
export interface FlowSurfaceErrorItem {
    index?: number;
    message: string;
    type: FlowSurfaceErrorType;
    code: string;
    status: number;
    path?: string;
    ruleId?: string;
    details?: Record<string, any>;
}
export type FlowSurfaceErrorItemInput = Omit<FlowSurfaceErrorItem, 'type' | 'code' | 'status'> & Partial<Pick<FlowSurfaceErrorItem, 'type' | 'code' | 'status'>>;
export type FlowSurfaceErrorOptions = {
    path?: string;
    ruleId?: string;
    details?: Record<string, any>;
};
export declare class FlowSurfaceError extends Error {
    readonly status: number;
    readonly type: FlowSurfaceErrorType;
    readonly code: string;
    readonly options: FlowSurfaceErrorOptions;
    constructor(message: string, status: number, type: FlowSurfaceErrorType, code: string, options?: FlowSurfaceErrorOptions);
    toResponseBody(): {
        errors: FlowSurfaceErrorItem[];
    };
}
export declare class FlowSurfaceBadRequestError extends FlowSurfaceError {
    constructor(message: string, code?: string, options?: FlowSurfaceErrorOptions);
}
export declare class FlowSurfaceForbiddenError extends FlowSurfaceError {
    constructor(message: string, code?: string);
}
export declare class FlowSurfaceConflictError extends FlowSurfaceError {
    constructor(message: string, code?: string);
}
export declare class FlowSurfaceInternalError extends FlowSurfaceError {
    constructor(message: string, code?: string);
}
export declare class FlowSurfaceAggregateError extends FlowSurfaceError {
    readonly errors: FlowSurfaceErrorItem[];
    constructor(errors: FlowSurfaceErrorItemInput[], message?: string);
    toResponseBody(): {
        message: string;
        errorCount: number;
        details: {
            requiredBlockPolicy?: {
                requiredBlockTypes: string[];
                fixStrategy: string;
                doNotReplaceOrDrop: boolean;
            };
            errorCount: number;
            mustFixAllErrorsBeforeRetry: boolean;
            retryPolicy: string;
            sameWriteRetryRequired: boolean;
            agentInstruction: string;
        };
        errors: FlowSurfaceErrorItem[];
    };
}
export declare function isFlowSurfaceError(error: unknown): error is FlowSurfaceError;
export declare function isFlowSurfaceBadRequestError(error: unknown): error is FlowSurfaceBadRequestError;
export declare function isFlowSurfaceAggregateError(error: unknown): error is FlowSurfaceAggregateError;
export declare function isFlowSurfaceForbiddenError(error: unknown): error is FlowSurfaceForbiddenError;
export declare function isFlowSurfaceConflictError(error: unknown): error is FlowSurfaceConflictError;
export declare function isFlowSurfaceInternalError(error: unknown): error is FlowSurfaceInternalError;
export declare function toFlowSurfaceErrorItem(error: FlowSurfaceError): FlowSurfaceErrorItem;
export declare function normalizeFlowSurfaceError(error: unknown): FlowSurfaceError;
export declare function throwBadRequest(message: string, codeOrOptions?: string | FlowSurfaceErrorOptions, options?: FlowSurfaceErrorOptions): never;
export declare function throwAggregateBadRequest(errors: FlowSurfaceErrorItemInput[]): never;
export declare function throwForbidden(message: string, code?: string): never;
export declare function throwConflict(message: string, code?: string): never;
export declare function throwInternalError(message: string, code?: string): never;
