import { IKosDataModel, IKosIdentifiable, KosContext, KosCreationContext } from '../../../core';
import { PublicModelInterface } from '../../../core/types';
import { LocaleDescriptor, TranslationResponse } from './services';
import { TranslationOptions } from './types';
export declare const MODEL_TYPE = "translation-model";
interface ResolveTranslationOptionsBase<T = string> {
    context?: string;
    defaultValue?: T;
}
interface ResolveTranslationsDataOptions<T = string> extends ResolveTranslationOptionsBase<T> {
    data: Record<string, any> | string;
}
type ResolveTranslationsOptionsMap<T = string> = ResolveTranslationOptionsBase<T> & Record<string, string | number | boolean | undefined | null>;
export type ResolveTranslationOptions<T = string> = ResolveTranslationsDataOptions<T> | ResolveTranslationsOptionsMap<T>;
/**
 * Translation - Individual namespace translations with automatic locale switching and interpolation.
 *
 * The Translation model provides access to localized text for a specific namespace within a KOS
 * application. It handles locale switching, fallback chains, variable interpolation, and context-aware
 * translations for building truly international device interfaces that adapt to user language preferences
 * automatically.
 *
 * ## Key Features
 * - **Namespace Isolation** - Translations organized by functional area or feature
 * - **Automatic Locale Switching** - React to parent container locale changes
 * - **Fallback Chains** - Graceful degradation through locale hierarchy (pt-BR → pt → es → en)
 * - **Variable Interpolation** - Support for both template (`{{variable}}`) and macro (`__variable__`) substitution
 * - **Context-Aware Keys** - Conditional translations based on context (e.g., `title_edit` vs `title`)
 * - **Real-time Updates** - Automatic UI updates when locale or translations change
 * - **Bundle Resolution** - Custom loading strategies for different deployment scenarios
 *
 * ## Variable Interpolation Patterns
 * The model supports two interpolation patterns for dynamic content:
 * - **Template Variables** (`{{variable}}`) - Context-based substitution passed via options
 * - **Macro Variables** (`__variable__`) - Data-based substitution from nested objects
 *
 * ## Fallback Resolution
 * When translations are missing, the system follows a sophisticated fallback chain:
 * 1. **Current locale** (e.g., `pt-BR`)
 * 2. **Parent locale** (e.g., `pt`)
 * 3. **Fallback locales** (configured per locale, e.g., `es`)
 * 4. **Default locale** (typically `en`)
 * 5. **Provided default value** or raw key
 *
 * ## Common Use Cases
 * - **Feature-Specific UI** - Isolated translations for dashboards, settings, alerts
 * - **Form Validation** - Localized error messages with variable interpolation
 * - **Status Displays** - Dynamic content with device state and user context
 * - **Multi-Language Interfaces** - Complete internationalization for global deployments
 * - **Context-Aware Content** - Mode-specific text (create vs edit, online vs offline)
 * - **Rich Text Support** - Integration with Trans component for formatted content
 *
 * @interface
 * @example Basic Usage
 * ```typescript
 * const statusTranslations = Translation.instance('device-status')
 *   .options({
 *     namespace: 'device-status',
 *     currentLocale: 'es',
 *     defaultLocale: 'en',
 *     descriptor: {
 *       'es': { fallbacks: ['en'] },
 *       'en': { fallbacks: [] }
 *     }
 *   })
 *   .build();
 *
 * // Resolve localized keys with fallback support
 * const title = statusTranslations.resolveKey('title');
 * ```
 *
 * @group KOS Model
 * @category i18n
 * @useDeclaredType
 *
 * @see {@link TranslationOptions} - Configuration options for Translation instances
 * @see {@link TranslationContainerModel} - Container for managing multiple translation namespaces
 * @see {@link useKosTranslation} - React hook for accessing translations in components
 * @see {@link Trans} - React component for rich text translations with markup
 */
export type TranslationModel = PublicModelInterface<TranslationModelImpl>;
export declare const expandMacros: (text: string, data: Record<string, any>) => any;
export declare const replaceText: (text: string, data: Record<string, any>, context?: Record<string, any>) => any;
export declare class TranslationModelImpl implements IKosDataModel, IKosIdentifiable {
    /** Unique identifier for the model instance */
    id: string;
    /** Namespace identifier for translation key isolation */
    namespace: string;
    /** Locale descriptor configuration mapping locales to fallback chains */
    descriptor: Record<string, LocaleDescriptor>;
    /** Default locale to use when no translation is found in fallback chain */
    defaultLocale: string;
    /** Currently active locale for translation resolution */
    currentLocale: string;
    /** Custom bundle resolver for loading translation data */
    bundleResolver?: (namespace: string, locale: string, context?: KosContext) => Promise<TranslationResponse>;
    /** Flattened translation data for efficient key lookup */
    private data;
    /** Context logger for debugging and diagnostics */
    private logger;
    /** Path resolver function for translation bundle location */
    private resolver;
    /** Reaction disposer for locale change monitoring */
    private disposer?;
    /** Parent translation container reference for namespace resolution */
    private context;
    /** Base URL for loading translation resources */
    private rootUrl?;
    constructor(modelId: string, options: TranslationOptions, context: KosCreationContext);
    /**
     * Builds the fallback chain for a given locale.
     * @param locale The locale to get translation fallback chain for
     * @returns Array of locales in priority order
     * @private
     */
    getTranslationLocales(locale: string): string[];
    /**
     * Loads and merges translations for all locales in the fallback chain.
     * @private
     */
    private loadTranslations;
    /**
     * @internal
     */
    init(): Promise<void>;
    /**
     * Checks if a translation key exists in the current namespace.
     * @param _key Translation key, optionally with namespace prefix
     * @returns True if the key exists
     */
    exists(_key: string): any;
    /**
     * Resolves a translation key with optional variable interpolation.
     * @param _key Translation key, optionally with namespace prefix
     * @param options Options for interpolation and fallback
     * @returns Resolved translation string or array
     */
    resolveKey<T = string>(_key: string, options?: ResolveTranslationOptions<T> | string): any;
    /**
     * @internal
     */
    unload(): void;
    /**
     * @internal
     */
    load(): Promise<void>;
    /**
     * @internal
     */
    ready(): Promise<void>;
    handleCurrentLocaleChange(): Promise<void>;
}
export {};
//# sourceMappingURL=translation-model.d.ts.map