import { default as default_2 } from 'react';

/**
 * Generic app event structure
 * @template TType - Event type string
 * @template TData - Event data payload
 */
declare type AppEvent<TType extends string = string, TData = Record<string, unknown>> = {
    /** The type of event that occurred */
    type: TType;
    /** Data associated with the event */
    data: TData;
};

/**
 * Available environments for the Fund Withdrawals service.
 */
declare type Environment = 'local' | 'dev' | 'cert' | 'prod';

/**
 * Generic error codes for all Connect applications
 */
declare enum ErrorCode {
    /** Network connectivity error */
    NETWORK_ERROR = 'network_error',
    /** Authentication or session expired error */
    AUTH_ERROR = 'auth_error',
    /** Resource not found error */
    NOT_FOUND_ERROR = 'not_found_error',
    /** Validation error from user input */
    VALIDATION_ERROR = 'validation_error',
    /** Server error (5xx) */
    SERVER_ERROR = 'server_error',
    /** Client error (4xx) */
    CLIENT_ERROR = 'client_error',
    /** Unknown or unexpected error */
    UNKNOWN_ERROR = 'unknown_error',
}

/**
 * Generic error payload structure for error callbacks
 */
declare type ErrorPayload = {
    /** Error code indicating the type of error */
    errorCode: ErrorCode;
    /** Human-readable reason for the error */
    reason: string;
};

/**
 * A React wrapper component for the Fund Withdrawals product.
 *
 * @example
 * ```tsx
 * <FundWithdrawals jwt="your-jwt-token" env="cert" />
 * ```
 */
export declare const FundWithdrawals: default_2.FC<FundWithdrawalsProps>;

declare type FundWithdrawalsCompletedData = {
    /** External account identifier the funds were sent to */
    externalAccountId: string;
    /** Symbol of the asset that was withdrawn (e.g. 'BTC') */
    assetSymbol: string;
    /** Quantity withdrawn as a string */
    amount: string;
};

declare type FundWithdrawalsEvent = AppEvent<FundWithdrawalsEventType>;

declare type FundWithdrawalsEventType = string;

declare interface FundWithdrawalsProps {
    /**
     * JWT token used for authentication.
     */
    jwt: string;
    /**
     * Target environment for the Fund Withdrawals service.
     *
     * @default "prod"
     */
    env?: Environment;
    /**
     * Theme mode.
     *
     * @default "auto"
     */
    theme?: Theme;
    /**
     * App link that brings the user back to the host app from another app, such
     * as a wallet after a WalletConnect approval: an https universal/app link or a
     * custom-scheme deep link. Set by the native SDK shells only. Browser
     * embeddings ignore it.
     */
    appRedirectUrl?: string;
    /**
     * When true, the widget renders as the Payouts flow. When false or omitted,
     * renders as the standard Fund Withdrawals flow.
     *
     * @default false
     */
    isPayouts?: boolean;
    /**
     * Callback invoked when the withdrawal flow is successfully completed.
     */
    onCompleted?: (data: FundWithdrawalsCompletedData) => void;
    /**
     * Callback invoked when an error occurs.
     */
    onError?: (error: ErrorPayload) => void;
    /**
     * Callback invoked when the user closes the widget.
     */
    onClose?: () => void;
    /**
     * Callback invoked when the widget has finished loading and is ready.
     */
    onLoaded?: () => void;
    /**
     * Callback invoked for general application events during the flow.
     */
    onEvent?: (event: FundWithdrawalsEvent) => void;
}

/**
 * Theme mode for the Fund Withdrawals interface.
 */
declare type Theme = 'auto' | 'light' | 'dark';

export { }


declare global {
    namespace JSX {
        interface IntrinsicElements {
            [WEB_COMPONENT_TAG]: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
                jwt: string;
                env?: Environment;
                theme?: Theme;
                'is-payouts'?: string;
            };
        }
    }
}
