/**
 * Result type for standardized error handling across the SDK
 *
 * This is a discriminated union that provides type-safe error handling
 * without throwing exceptions. Inspired by Rust's Result<T, E> type.
 *
 * @example
 * ```typescript
 * async function createLoan(request: CreateLoanRequest): Promise<Result<LoanData, SDKError>> {
 *   try {
 *     const loan = await performCreation(request);
 *     return success(loan);
 *   } catch (error) {
 *     return failure(SDKError.from(error));
 *   }
 * }
 *
 * // Usage
 * const result = await createLoan(request);
 * if (result.success) {
 *   console.log('Loan created:', result.value);
 * } else {
 *   console.error('Failed:', result.error);
 * }
 * ```
 */
/**
 * Success variant of Result<T, E>
 */
export interface Success<T> {
    success: true;
    value: T;
}
/**
 * Failure variant of Result<T, E>
 */
export interface Failure<E> {
    success: false;
    error: E;
}
/**
 * Result type - either Success<T> or Failure<E>
 */
export type Result<T, E = Error> = Success<T> | Failure<E>;
/**
 * Creates a successful Result
 */
export declare function success<T>(value: T): Success<T>;
/**
 * Creates a failed Result
 */
export declare function failure<E>(error: E): Failure<E>;
/**
 * Type guard to check if Result is successful
 */
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
/**
 * Type guard to check if Result is a failure
 */
export declare function isFailure<T, E>(result: Result<T, E>): result is Failure<E>;
/**
 * Unwraps a Result, returning the value or throwing the error
 */
export declare function unwrap<T, E extends Error>(result: Result<T, E>): T;
/**
 * Unwraps a Result, returning the value or a default
 */
export declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
/**
 * Maps a Result<T, E> to Result<U, E> by applying a function to the success value
 */
export declare function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
/**
 * Maps a Result<T, E> to Result<T, F> by applying a function to the error value
 */
export declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
/**
 * Chains Result-returning operations together (flatMap)
 */
export declare function andThen<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
/**
 * Returns the first successful Result, or the last error if all fail
 */
export declare function firstSuccess<T, E>(results: Result<T, E>[]): Result<T, E>;
/**
 * Collects all successful Results into an array
 */
export declare function collectSuccesses<T, E>(results: Result<T, E>[]): T[];
/**
 * Collects all failures into an array
 */
export declare function collectFailures<T, E>(results: Result<T, E>[]): E[];
/**
 * Combines multiple Results into a single Result containing an array
 * If any Result fails, returns the first failure
 */
export declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
/**
 * Wraps an async function that may throw into one that returns a Result
 */
export declare function tryCatch<T, E = Error>(fn: () => T, errorHandler?: (error: unknown) => E): Result<T, E>;
/**
 * Async version of tryCatch
 */
export declare function tryCatchAsync<T, E = Error>(fn: () => Promise<T>, errorHandler?: (error: unknown) => E): Promise<Result<T, E>>;
/**
 * Converts a Result to a Promise that rejects on failure
 */
export declare function toPromise<T, E extends Error>(result: Result<T, E>): Promise<T>;
/**
 * Converts a Promise to a Result (will never reject)
 */
export declare function fromPromise<T, E = Error>(promise: Promise<T>, errorHandler?: (error: unknown) => E): Promise<Result<T, E>>;
/**
 * Utility to match on a Result and handle both cases
 */
export declare function match<T, E, U>(result: Result<T, E>, handlers: {
    success: (value: T) => U;
    failure: (error: E) => U;
}): U;
