import { ConfigPropertyTypes } from '../types';
import { ConfigBeanUpdateResponse } from '../../services/config-bean';
import { ConfigBeanKeys, IConfigBeanModelOptions } from './config-bean-types';
import { IKosDataModel, KosData, PublicModelInterface, KosModelRegistrationFactory } from '../../../core';

/**
 * ConfigBean - Reactive hierarchical configuration management for KOS devices.
 *
 * The ConfigBean model provides reactive access to hierarchical configuration data from KOS devices
 * with real-time synchronization via WebSocket topics, schema-based validation, and transactional
 * updates. Essential for building configuration interfaces and managing device operational parameters.
 *
 * ## Key Features
 * - **Hierarchical Configuration** - Access nested configuration structures using path notation
 * - **Real-Time Synchronization** - Automatic updates via `/kos/config/{path}` WebSocket topic
 * - **Schema-Based Validation** - Built-in validation using device configuration schemas
 * - **Transactional Updates** - Atomic configuration changes with rollback support
 * - **Type-Safe Access** - Strongly typed property access with TypeScript support
 * - **Reactive Properties** - Automatic UI updates when configuration changes
 *
 * ## Configuration Path Patterns
 * ConfigBean supports hierarchical paths that mirror device system organization:
 * - **System Level**: `system:app` - Machine identity, operational modes
 * - **Service Level**: `kos:service:CANPumpMgr` - KOS service configurations
 * - **Hardware Level**: `assembly:core:board:macro:pump:water` - Component settings
 * - **Application Level**: `app:scheduling:dayWiseLockConfigMap` - Application-specific settings
 *
 * ## Common Use Cases
 * - **Configuration Interfaces** - Build reactive configuration management screens
 * - **Operational Parameter Control** - Real-time adjustment of device behavior
 * - **Schema-Driven Forms** - Generate configuration UIs from device schemas
 * - **System Administration** - Centralized device configuration management
 * - **Bulk Configuration Updates** - Transactional updates across multiple properties
 *
 * @example Basic Configuration Management
 * ```typescript
 * const systemConfig = ConfigBean.instance('system-config')
 *   .options({ path: 'system:app' })
 *   .build();
 *
 * // Access current configuration values
 * const machineId = systemConfig.values.machineId;
 * const debugMode = systemConfig.values.debugMode;
 *
 * // Update configuration properties
 * await systemConfig.updateProperty('debugMode', true);
 * await systemConfig.updateProperty('machineId', 'MACHINE-001');
 * ```
 *
 * @interface
 * @group KOS Model
 * @category Configuration
 * @useDeclaredType
 *
 * @see {@link IConfigBeanModelOptions} - Configuration options for ConfigBean instances
 * @see {@link ConfigBeanKeys} - Type-safe property key access
 * @see {@link ConfigPropertyTypes} - Supported configuration property types
 */
export type IConfigBeanModel<T extends {} = any> = PublicModelInterface<ConfigBeanModelImpl<T>>;
export declare const CONFIG_BEAN_MODEL_TYPE = "config-bean-model";
/**
 * @ignore
 * @internal
 */
declare class ConfigBeanModelImpl<T extends {} = any> implements IKosDataModel {
    /** Service function for modifying configuration beans */
    private _modifyConfigBean;
    /** Service function for retrieving configuration beans */
    private _getConfigBean;
    /** Schema response containing configuration property definitions */
    private _schema?;
    /** Unique identifier for this configuration model instance */
    id: string;
    /** Hierarchical configuration path (e.g., 'system:app', 'kos:service:CANPumpMgr') */
    path: string;
    /** Observable configuration properties with current values */
    props: KosData<Record<ConfigBeanKeys<T>, ConfigPropertyTypes>>;
    /** Observable configuration properties with previous values (before last update) */
    prevProps: KosData<Record<ConfigBeanKeys<T>, ConfigPropertyTypes>>;
    /** Optional custom base path for configuration service endpoints */
    serviceBasePath?: string;
    /**
     * @category Constructor
     *
     * @param modelId - the unique modelId for this Config Bean
     * @param options - any options that should be merged into the Config Bean
     * @params options.id - the unique id of the Config Bean
     * @params options.name - the name of the Config Bean
     *
     */
    constructor(modelId: string, options: IConfigBeanModelOptions);
    /**
     * Gets current configuration property values.
     *
     * @returns Object containing all configuration properties with their current values
     *
     * @example Access Configuration Values
     * ```typescript
     * const currentValues = systemConfig.values;
     * console.log('Machine ID:', currentValues.machineId);
     * console.log('Debug Mode:', currentValues.debugMode);
     * ```
     */
    get values(): Record<keyof T, unknown>[keyof T][];
    /**
     * @internal
     */
    ready(): Promise<void>;
    /**
     * @internal
     *
     * @remarks
     * No action is taken as part of the load lifecycle method.
     *
     * In future additional information about the workspace could be loaded
     */
    load(): Promise<void>;
    /**
     * Gets all available schema property keys.
     *
     * @returns Array of property keys from the configuration schema
     */
    get schemaKeys(): string[];
    /**
     * Retrieves schema definition for a specific property.
     *
     * @param key - Property key to get schema for
     * @returns Schema definition if found, undefined otherwise
     *
     * @example Get Property Schema
     * ```typescript
     * const schema = systemConfig.getSchemaForProperty('debugMode');
     * if (schema) {
     *   console.log('Type:', schema.type);
     *   console.log('Description:', schema.description);
     * }
     * ```
     */
    getSchemaForProperty(key: string): import('../../services/config-bean').SchemaNodeDef | undefined;
    /**
     * Updates a specific configuration property value.
     *
     * @category Action
     *
     * @param key - The configuration property key to update
     * @param value - The new value to set for the property
     *
     * @example Update Configuration Property
     * ```typescript
     * await systemConfig.updateProperty('debugMode', true);
     * await systemConfig.updateProperty('machineId', 'MACHINE-001');
     * ```
     */
    updateProperty(key: ConfigBeanKeys<T>, value: ConfigPropertyTypes): Promise<void>;
    /**
     * @category Action
     *
     * @remark
     * Updates the current Config Bean representation in the backend.
     *
     * If a service was passed in as part of the options in the constructor
     * then it will be used.  Otherwise the default services will be invoked.
     *
     * @see modifyConfigBeanService
     */
    updateConfigBean(): Promise<void>;
    /**
     * @category Subscription
     * Updates the Config Bean model when a `/kos/config/{path}` event
     * is received from the server.
     *
     * @param configBean - the Config Bean that was updated.
     * @see ConfigBeanResponse
     */
    handleConfigBeanUpdated(configBean: ConfigBeanUpdateResponse): void;
}
export declare const ConfigBean: KosModelRegistrationFactory<IConfigBeanModel<any>, IConfigBeanModelOptions>;
export {};
//# sourceMappingURL=config-bean-model.d.ts.map