import React, { ReactElement } from 'react';
import { RenderOptions, RenderResult } from '@testing-library/react';
export * from '@testing-library/react';
import { SemiontBrowser, SemiontSession, SemiontClient } from '@semiont/sdk';
import { EventBus } from '@semiont/core';
export { vi } from 'vitest';

/**
 * Translation management interface
 * Apps implement this to provide translations using their preferred i18n library
 */
interface TranslationManager {
    /**
     * Translate a key within a namespace
     * @param namespace - Translation namespace (e.g., 'Toolbar', 'ResourceViewer')
     * @param key - Translation key within the namespace
     * @param params - Optional parameters for interpolation
     * @returns Translated string
     */
    t: (namespace: string, key: string, params?: Record<string, any>) => string;
}

/**
 * Test utilities for @semiont/react-ui
 *
 * Provides a renderWithProviders helper that wraps components with all necessary providers
 * for testing, with customizable mock implementations.
 */

/**
 * Default mock implementations
 */
declare const defaultMocks: {
    translationManager: TranslationManager;
};
/**
 * Options for renderWithProviders
 */
interface TestProvidersOptions {
    translationManager?: TranslationManager;
    apiBaseUrl?: string;
    /** Inject a specific SemiontBrowser (e.g. one seeded with a kbs list). */
    browser?: SemiontBrowser;
}
interface RenderWithProvidersOptions extends TestProvidersOptions, Omit<RenderOptions, 'wrapper'> {
    /**
     * If true, returns the session (client) EventBus — session-scoped
     * channels (mark:*, beckon:*, gather:*, match:*, bind:*, yield:*,
     * browse:click, browse:reference-navigate, browse:entity-type-clicked).
     */
    returnEventBus?: boolean;
    /**
     * If true, returns the app-scoped (SemiontBrowser) EventBus — panel:*,
     * shell:*, tabs:*, nav:*, settings:*.
     */
    returnShellBus?: boolean;
}
interface RenderWithProvidersResult extends RenderResult {
    /** Session-scoped bus (from the fake client inside the fake browser). */
    eventBus?: EventBus;
    /** App-scoped bus (the fake browser's own bus). */
    shellBus?: EventBus;
    /** The fake session — pass as the `session` prop to provider-free components. */
    session: SemiontSession | null;
}
declare function renderWithProviders(ui: ReactElement, options?: RenderWithProvidersOptions): RenderWithProvidersResult;
/**
 * Build a minimal `<SemiontProvider>` wrapper for tests that roll their
 * own render wrapper (instead of `renderWithProviders`). The returned
 * `eventBus` is the bus backing the fake session's client — same
 * reference production code pokes via `session.client.emit(...)`.
 */
declare function createTestSemiontWrapper(apiBaseUrl?: string): {
    SemiontWrapper: React.ComponentType<{
        children: React.ReactNode;
    }>;
    /** Session-scoped bus (from the fake client). */
    eventBus: EventBus;
    /** App-scoped bus (the fake browser's own bus). */
    shellBus: EventBus;
    /** The fake session's client — for tests that need to spy on namespace methods. */
    client: SemiontClient;
    /** The fake session — pass as the `session` prop to provider-free components. */
    session: SemiontSession;
};
/**
 * Create a mock translation manager with custom translations
 */
declare function createMockTranslationManager(translations: Record<string, Record<string, string>>): TranslationManager;
/**
 * Build a fake SemiontBrowser with the active SessionSignals
 * observables pre-populated. Used by SessionExpiredModal and
 * PermissionDeniedModal tests that need to control the modal flags
 * without driving a real session through its state machine.
 */
declare function createMockKnowledgeBaseSession(overrides?: {
    permissionDeniedAt?: number | null;
    permissionDeniedMessage?: string | null;
    sessionExpiredAt?: number | null;
    sessionExpiredMessage?: string | null;
    acknowledgePermissionDenied?: () => void;
    acknowledgeSessionExpired?: () => void;
}): SemiontBrowser;

export { createMockKnowledgeBaseSession, createMockTranslationManager, createTestSemiontWrapper, defaultMocks, renderWithProviders };
export type { RenderWithProvidersOptions, RenderWithProvidersResult, TestProvidersOptions };
