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 Connect Profile service.
 *
 * - `"local"` - Local development environment
 * - `"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;
};

/**
 * A React wrapper component for the Connect Profile product.
 */
export declare const Profile: default_2.FC<ProfileProps>;

declare type ProfileEvent = AppEvent<ProfileEventType>;

declare type ProfileEventType = string;

declare interface ProfileProps {
    /**
     * JWT token used for authentication with the Connect Profile service.
     */
    jwt: string;
    /**
     * Target environment for the Connect Profile service.
     *
     * @default "prod"
     */
    env?: Environment;
    /**
     * Theme mode for the Connect Profile interface.
     *
     * @default "auto"
     */
    theme?: Theme;
    /**
     * Callback invoked when an error occurs during the profile flow.
     */
    onError?: (error: ErrorPayload) => void;
    /**
     * Callback invoked when the user closes the profile widget.
     */
    onClose?: () => void;
    /**
     * Callback invoked when the profile widget has finished loading and is ready.
     */
    onLoaded?: () => void;
    /**
     * Callback invoked for general application events during the profile flow.
     */
    onEvent?: (event: ProfileEvent) => void;
}

/**
 * Theme mode for the Connect Profile 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 Profile 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;
            };
        }
    }
}
