/**
 * Copyright 2024 Mytra Control S.L. All rights reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
 * or at https://opensource.org/licenses/MIT.
 */
import { Multi } from '@mdf.js/crash';
import { Setup } from '@mdf.js/service-setup-provider';
import EventEmitter from 'events';
import { Package } from 'normalize-package-data';
import { BootstrapOptions, CustomSetting, ServiceRegistryOptions, ServiceRegistrySettings } from '../types';
/**
 * SettingsManager is responsible for managing the application's settings, including the
 * configuration for the service registry and custom settings specified by the user. It extends
 * EventEmitter to allow for emitting events related to settings management and implements the
 * Service interface from the Layer.App namespace, indicating its role in the application's service
 * architecture. It utilizes configuration managers for both service registry and custom settings,
 * supporting dynamic loading and management of these configurations.
 *
 * Additionally, it can load application metadata from package.json and README.md content, providing
 * a centralized way to access application information and documentation.
 */
export declare class SettingsManagerBase<CustomSettings extends Record<string, CustomSetting> = Record<string, CustomSetting>> extends EventEmitter {
    /** Instance identifier */
    readonly instanceId: string;
    /** Service Register Settings provider */
    protected readonly serviceRegistrySettingsProvider: Setup.Provider<ServiceRegistrySettings<CustomSettings>>;
    /** Custom Settings provider */
    protected readonly customSettingsProvider: Setup.Provider<CustomSettings>;
    /** Package version info */
    readonly package?: Package;
    /** Readme file content */
    readonly readme?: string;
    /** Validation error, if exist */
    protected _error?: Multi;
    /**
     * Constructs a SettingsManager instance, initializing configuration providers and loading
     * `package.json` and README information.
     * @param bootstrapSettings - Bootstrap settings, define how the Custom and the Service Registry
     * settings should be loaded.
     * @param serviceRegistrySettings - Service Registry settings, used as a base for the Service
     * Registry configuration manager.
     * @param customSettings - Custom settings provided by the user, used as a base for the Custom
     * configuration manager.
     */
    constructor(bootstrapSettings?: BootstrapOptions, serviceRegistrySettings?: ServiceRegistryOptions<CustomSettings>, customSettings?: Partial<CustomSettings>);
    /**
     * Loads package.json information, normalizing its structure and extracting relevant metadata for
     * application settings.
     * @param flag - Indicates whether package information should be loaded or not.
     * @returns An object containing parsed package information or undefined if loading is not
     * requested or fails.
     */
    private loadPackageInfo;
    /**
     * Loads `README.md` content, converting it to HTML using markdown-it for easy display or use
     * within the application.
     * @param fileName - The file name of the readme or a boolean indicating if the default
     * `README.md` should be loaded.
     * @returns The rendered HTML content of the `README.md` file or undefined if not found or
     * loading is not requested.
     */
    private loadReadme;
    /**
     * Adds an error to the validation error list, creating a new Multi error if necessary. If the
     * error is a Multi error, its causes are added to the list.
     * @param error - The error to add to the validation error list.
     */
    private addError;
    /**
     * Defines the configuration options to create an instance of a `ConfigManager` `Provider` to
     * manage the Service Registry settings, based in the Bootstrap settings and the Service Registry
     * initial settings.
     * @param bootstrapSettings - Bootstrap settings
     * @param serviceRegistrySettings - Initial Service Registry settings
     * @returns The configuration options for initializing the `ServiceRegistry` `ConfigManager`
     * `Provider`.
     */
    private defineServiceRegistryConfigManagerOptions;
    /**
     * Defines the configuration options to create an instance of a `ConfigManager` `Provider` to
     * manage the Custom settings, based on the Service Registry settings and the initial custom
     * settings.
     * @param configLoader - Configuration loader settings
     * @param customSettings - Initial Custom settings
     * @returns The configuration options for initializing the Custom settings `ConfigManager`
     * `Provider`.
     */
    private defineCustomSettingsConfigManager;
    /** Start the underlying configuration providers */
    start(): Promise<void>;
    /** Stop the underlying configuration providers */
    stop(): Promise<void>;
    /** Close the underlying configuration providers */
    close(): Promise<void>;
}
//# sourceMappingURL=SettingsManagerBase.d.ts.map