/**
 * @module dual-mode
 * Dual-mode adapter: XBind + API key fallback.
 *
 * Enables zero-downtime migration:
 * - Try XBind first
 * - Fall back to API key if unavailable
 * - Track usage metrics
 *
 * @example
 * ```ts
 * const adapter = new DualModeAdapter({
 *   xbind: xbindAgent,
 *   fallback: {
 *     type: 'api-key',
 *     key: process.env.API_KEY,
 *     url: 'https://api.example.com',
 *   },
 * });
 *
 * // Will try xBind, fall back to API key
 * const result = await adapter.call('createCharge', { amount: 100 });
 * ```
 */
import { Result } from '@private.me/shared';
import type { Agent } from './agent.js';
/**
 * Fallback configuration.
 */
export interface FallbackConfig {
    /** Fallback type */
    type: 'api-key' | 'oauth' | 'custom';
    /** API key (for type: 'api-key') */
    key?: string;
    /** Base URL */
    url: string;
    /** Custom headers */
    headers?: Record<string, string>;
    /** HTTP method (default: POST) */
    method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
}
/**
 * Usage metrics.
 */
export interface UsageMetrics {
    /** Total calls */
    totalCalls: number;
    /** Calls via XBind */
    xbindCalls: number;
    /** Calls via fallback */
    fallbackCalls: number;
    /** XBind usage percentage */
    xbindPercentage: number;
    /** Last call timestamp */
    lastCall: string;
    /** Last call method */
    lastCallMethod: 'xbind' | 'fallback';
}
/**
 * Dual-mode error codes.
 */
export declare enum DualModeErrorCode {
    BOTH_FAILED = "DUAL_MODE_BOTH_FAILED",
    XBIND_FAILED = "DUAL_MODE_XBIND_FAILED",
    FALLBACK_FAILED = "DUAL_MODE_FALLBACK_FAILED",
    INVALID_CONFIG = "DUAL_MODE_INVALID_CONFIG"
}
/**
 * Dual-mode error.
 */
export interface DualModeError {
    code: DualModeErrorCode;
    message: string;
    xbindError?: unknown;
    fallbackError?: unknown;
}
/**
 * Dual-mode adapter.
 *
 * Tries XBind first, falls back to API key if unavailable.
 */
export declare class DualModeAdapter {
    private xbind;
    private fallback;
    private metrics;
    /**
     * Create dual-mode adapter.
     *
     * @param options - Configuration
     * @param options.xbind - xBind agent (optional, can be added later)
     * @param options.fallback - Fallback config (optional, can be removed later)
     */
    constructor(options?: {
        xbind?: Agent;
        fallback?: FallbackConfig;
    });
    /**
     * Set xBind agent (for gradual rollout).
     *
     * @param agent - xBind agent
     */
    setXBind(agent: Agent): void;
    /**
     * Remove fallback (complete migration).
     */
    removeFallback(): void;
    /**
     * Call an action (tries XBind first, falls back if needed).
     *
     * @param action - Action name
     * @param params - Action parameters
     * @returns Result or error
     *
     * @example
     * ```ts
     * const result = await adapter.call('createCharge', {
     *   amount: 100,
     *   currency: 'USD',
     * });
     * ```
     */
    call<T = unknown>(action: string, params?: Record<string, unknown>): Promise<Result<T, DualModeError>>;
    /**
     * Get usage metrics.
     *
     * @returns Current metrics
     */
    getMetrics(): UsageMetrics;
    /**
     * Reset metrics.
     */
    resetMetrics(): void;
    /**
     * Call via XBind.
     */
    private callViaXBind;
    /**
     * Call via fallback (API key, OAuth, etc.).
     */
    private callViaFallback;
    /**
     * Update metrics after a call.
     */
    private updateMetrics;
}
