/**
 * 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 { LoggerInstance } from '@mdf.js/logger';
import { Consumer, ResolverMap } from '@mdf.js/openc2';
import { EventEmitter } from 'stream';
import { ServiceRegistryOptions } from '../types';
/**
 * ControlManager handles OpenC2 command and control interactions, serving as the bridge between
 * OpenC2 Consumers and the Service.
 * It extends EventEmitter to re-emit the events of the OpenC2 Consumer (e.g., command execution,
 * errors, and status updates).
 */
export declare class ControlManager extends EventEmitter {
    private readonly serviceRegistrySettings;
    private readonly logger;
    private readonly defaultResolver?;
    /** OpenC2 Consumer instance */
    readonly instance?: Consumer;
    /** Validation error, if exist */
    private _error?;
    /**
     * Constructor for the ControlManager class.
     * @param serviceRegistrySettings - Service Registry settings, which include the consumer and
     * adapter configurations.
     * @param logger - Logger instance.
     * @param defaultResolver - This is the default resolver map for the OpenC2 interface, which is
     * merged with the resolver map from the service registry settings, if provided. The default
     * value, passed from the Service Registry instance include resolvers for the `features`:
     * - `query`: `health`, `stats`, `errors` and `config`
     * - `start`: `resources`
     * - `stop`: `resources`
     */
    constructor(serviceRegistrySettings: ServiceRegistryOptions, logger: LoggerInstance, defaultResolver?: ResolverMap | undefined);
    /**
     * Instantiates the OpenC2 Consumer instance based on the service registry settings.
     * @returns OpenC2 Consumer instance, if it was successfully instantiated.
     */
    private initializeOpenC2Consumer;
    /**
     * Returns the validation error, if exist.
     * @returns Multi error, if exist.
     */
    get error(): Multi | undefined;
    /**
     * Checks and return a validated version of adapter options.
     * @param options - Consumer adapter options
     * @returns OpenC2 adapter options, retrieved from the service registry settings, if provided.
     */
    private getAdapterOptions;
    /**
     * Checks and return a validated version of consumer options.
     * @param options - Service registry settings
     * @param defaultResolver - Default resolver map for the OpenC2 interface
     * @returns OpenC2 consumer options, retrieved from the service registry settings, if provided and
     * merged with some default options.
     */
    private getConsumerOptions;
    /**
     * Constructs and merges the action-target pairs for the OpenC2 interface based on the namespace
     * and service registry settings.
     * @param options - Service registry settings
     * @returns Action-Target pairs for the OpenC2 interface, merged with the default pairs for the
     */
    private getActionTargetPairs;
    /**
     * 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;
    /**
     * Event handler for the `command` event emitted by the OpenC2 Consumer instance.
     * @param command - The OpenC2 command job handler.
     * @returns void
     */
    private onCommandEvent;
    /**
     * Wraps the OpenC2 Consumer instance events with the ControlManager event handlers.
     * @param instance - The OpenC2 Consumer instance.
     * @returns void
     */
    private wrapConsumerEvents;
    /**
     * Starts the OpenC2 Consumer instance.
     * @returns Promise<void>
     */
    start(): Promise<void>;
    /**
     * Stops the OpenC2 Consumer instance.
     * @returns Promise<void>
     */
    stop(): Promise<void>;
}
//# sourceMappingURL=ControlManager.d.ts.map