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;
};

/**
 * A React wrapper component for the Connect CSP Crypto Sell product.
 *
 * @param props - Component properties
 * @param jwt - JWT token for authentication (required)
 * @param env - Target environment ("local" | "dev" | "cert" | "prod", defaults to "prod")
 * @param theme - Theme mode ("auto" | "light" | "dark", defaults to "auto")
 * @param onCompleted - Callback invoked when the sell flow is successfully completed
 * @param onError - Callback invoked when an error occurs
 * @param onClose - Callback invoked when the user closes the widget
 * @param onLoaded - Callback invoked when the widget has finished loading
 * @param onEvent - Callback invoked for general application events
 *
 * @example
 * ```tsx
 * <CspCryptoSell
 *   jwt="your-jwt-token"
 *   theme="light"
 *   onLoaded={() => console.log('CSP Crypto Sell loaded and ready')}
 *   onCompleted={({ amountSold, assetSymbol }) => console.log('Sold', amountSold, assetSymbol)}
 *   onClose={() => console.log('CSP Crypto Sell closed')}
 *   onError={({ errorCode, reason }) => console.error('Error:', errorCode, reason)}
 *   onEvent={(event) => console.log('Event:', event)}
 * />
 * ```
 *
 * @returns React component that renders the Connect CSP Crypto Sell interface
 */
export declare const CspCryptoSell: default_2.FC<CspCryptoSellProps>;

declare type CspCryptoSellCompletedData = {
    /** Symbol of the asset that was sold (e.g. 'BTC.BITCOIN') */
    assetSymbol: string;
    /** Quantity sold as a string */
    amountSold: string;
};

/**
 * CSP Crypto sell event structure
 */
declare type CspCryptoSellEvent = AppEvent<CspCryptoSellEventType>;

/**
 * CSP Crypto sell event type literals
 */
declare type CspCryptoSellEventType = string;

declare interface CspCryptoSellProps {
    /**
     * JWT token used for authentication with the Connect CSP Crypto Sell service.
     * This token should be obtained from your backend and contain the necessary
     * claims for user identification and authorization.
     *
     * @example "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
     */
    jwt: string;
    /**
     * Target environment for the Connect CSP Crypto Sell service.
     *
     * @default "prod"
     */
    env?: Environment;
    /**
     * Theme mode for the Connect CSP Crypto Sell interface.
     *
     * @default "auto"
     */
    theme?: Theme;
    /**
     * Callback invoked when the CSP crypto sell flow is successfully completed.
     *
     * @param data - Details about the completed sell, including amount sold and asset symbol
     */
    onCompleted?: (data: CspCryptoSellCompletedData) => void;
    /**
     * Callback invoked when an error occurs during the CSP crypto sell flow.
     *
     * @param error - Error details including error code and reason
     */
    onError?: (error: ErrorPayload) => void;
    /**
     * Callback invoked when the user closes the CSP crypto sell widget.
     */
    onClose?: () => void;
    /**
     * Callback invoked when the CSP crypto sell widget has finished loading and is ready.
     */
    onLoaded?: () => void;
    /**
     * Callback invoked for general application events during the CSP crypto sell flow.
     *
     * @param event - Event object containing the event type and associated data
     */
    onEvent?: (event: CspCryptoSellEvent) => void;
}

/**
 * Available environments for the Connect CSP Crypto Sell service.
 *
 * - `"local"` - Local development environment (http://localhost:4206)
 * - `"dev"` - Development environment for early-stage testing
 * - `"cert"` - Certificate/staging environment for integration testing
 * - `"prod"` - Live production environment for real applications
 */
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;
};

/**
 * Theme mode for the Connect CSP Crypto Sell interface.
 *
 * - `"auto"` - Automatically detect system preference (light/dark mode)
 * - `"light"` - Force light theme
 * - `"dark"` - Force dark theme
 */
declare type Theme = 'auto' | 'light' | 'dark';

export { }


declare global {
    namespace JSX {
        interface IntrinsicElements {
            /**
             * Connect CSP Crypto Sell web component element
             */
            [WEB_COMPONENT_TAG]: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
                /**
                 * JWT token for authentication
                 */
                jwt: string;
                /**
                 * Target environment ("local" | "dev" | "cert" | "prod")
                 */
                env?: Environment;
                /**
                 * Theme mode ("auto" | "light" | "dark")
                 */
                theme?: Theme;
            };
        }
    }
}
