/**
 * 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 { Health } from '@mdf.js/core';
import { Crash } from '@mdf.js/crash';
import { CommandJobHandler, ConsumerAdapter, ConsumerOptions, Control } from '../../types';
import { Component } from '../Component';
import { AdapterWrapper } from './core';
export declare interface Consumer {
    /**
     * Add a listener for the `error` event, emitted when the component detects an error.
     * @param event - `error` event
     * @param listener - Error event listener
     * @event
     */
    on(event: 'error', listener: (error: Crash | Error) => void): this;
    /**
     * Add a listener for the `error` event, emitted when the component detects an error.
     * @param event - `error` event
     * @param listener - Error event listener
     * @event
     */
    addListener(event: 'error', listener: (error: Crash | Error) => void): this;
    /**
     * Add a listener for the `error` event, emitted when the component detects an error. This is a
     * one-time event, the listener will be removed after the first emission.
     * @param event - `error` event
     * @param listener - Error event listener
     * @event
     */
    once(event: 'error', listener: (error: Crash | Error) => void): this;
    /**
     * Removes the specified listener from the listener array for the `error` event.
     * @param event - `error` event
     * @param listener - Error event listener
     * @event
     */
    off(event: 'error', listener: (error: Crash | Error) => void): this;
    /**
     * Removes the specified listener from the listener array for the `error` event.
     * @param event - `error` event
     * @param listener - Error event listener
     * @event
     */
    removeListener(event: 'error', listener: (error: Crash | Error) => void): this;
    /**
     * Removes all listeners, or those of the specified event.
     * @param event - `error` event
     */
    removeAllListeners(event?: 'error'): this;
    /**
     * Add a listener for the `status` event, emitted when the component changes its status.
     * @param event - `status` event
     * @param listener - Status event listener
     * @event
     */
    on(event: 'status', listener: (status: Health.Status) => void): this;
    /**
     * Add a listener for the `status` event, emitted when the component changes its status.
     * @param event - `status` event
     * @param listener - Status event listener
     * @event
     */
    addListener(event: 'status', listener: (status: Health.Status) => void): this;
    /**
     * Add a listener for the `status` event, emitted when the component changes its status. This is a
     * one-time event, the listener will be removed after the first emission.
     * @param event - `status` event
     * @param listener - Status event listener
     * @event
     */
    once(event: 'status', listener: (status: Health.Status) => void): this;
    /**
     * Removes the specified listener from the listener array for the `status` event.
     * @param event - `status` event
     * @param listener - Status event listener
     * @event
     */
    off(event: 'status', listener: (status: Health.Status) => void): this;
    /**
     * Removes the specified listener from the listener array for the `status` event.
     * @param event - `status` event
     * @param listener - Status event listener
     * @event
     */
    removeListener(event: 'status', listener: (status: Health.Status) => void): this;
    /**
     * Add a listener for the `command` event, emitted when a new command is received
     * @param event - `command` event
     * @param listener - Command event listener
     * @event
     */
    on(event: 'command', listener: (job: CommandJobHandler) => void): this;
    /**
     * Add a listener for the `command` event, emitted when a new command is received
     * @param event - `command` event
     * @param listener - Command event listener
     * @event
     */
    addListener(event: 'command', listener: (job: CommandJobHandler) => void): this;
    /**
     * Add a listener for the `command` event, emitted when a new command is received. This is a
     * one-time event, the listener will be removed after the first emission.
     * @param event - `command` event
     * @param listener - Command event listener
     * @event
     */
    once(event: 'command', listener: (job: CommandJobHandler) => void): this;
    /**
     * Removes the specified listener from the listener array for the `command` event.
     * @param event - `command` event
     * @param listener - Command event listener
     * @event
     */
    off(event: 'command', listener: (job: CommandJobHandler) => void): this;
    /**
     * Removes the specified listener from the listener array for the `command` event.
     * @param event - `command` event
     * @param listener - Command event listener
     * @event
     */
    removeListener(event: 'command', listener: (job: CommandJobHandler) => void): this;
    /**
     * Removes all listeners, or those of the specified event.
     * @param event - `command` event
     */
    removeAllListeners(event?: 'command'): this;
}
export declare class Consumer extends Component<AdapterWrapper, ConsumerOptions> {
    /**
     * Regular OpenC2 consumer implementation.
     * @param adapter - transport adapter
     * @param options - configuration options
     */
    constructor(adapter: ConsumerAdapter, options: ConsumerOptions);
    /**
     * Validate the resolver map if exists
     * @param options - configuration options
     * @returns
     */
    private validateResolver;
    /**
     * Validate a resolver entry format
     * @param entry - resolver entry to validate
     */
    private validateResolverEntry;
    /** Consumer actuators */
    get actuator(): string[] | undefined;
    set actuator(value: string[] | undefined);
    /** Consumer profiles */
    get profiles(): string[] | undefined;
    set profiles(value: string[] | undefined);
    /** Consumer pairs */
    get pairs(): Control.ActionTargetPairs;
    set pairs(value: Control.ActionTargetPairs);
    /** Initialize the OpenC2 component */
    protected startup(): Promise<void>;
    /** Shutdown the OpenC2 component */
    protected shutdown(): Promise<void>;
    /**
     * Process incoming command message from the adapter
     * @param incomingMessage - incoming message
     * @param done - callback to return the response
     */
    private readonly onCommandHandler;
    /**
     * Process incoming message and return a response if the message is a command that should be
     * responded
     * @param incomingMessage - incoming message
     */
    private readonly processCommand;
    /**
     * Process incoming command message and select a default response or emit a new job to execute
     * the command
     * @param command - command message to be processed
     */
    private classifyCommand;
    /**
     * Resolve a command message using a resolver
     * @param resolver - resolver function to be executed
     * @param message - message to be processed
     * @returns
     */
    private resolveCommand;
    /**
     * Execute a job and wait for the resolution
     * @param message - message to be processed as a job for upper layers
     */
    private emitCommandJob;
    /**
     * Create a job from a command message
     * @param message - command message
     * @returns
     */
    private createJobFromCommand;
    /**
     * Check if there is a resolver function for the command in the resolver map
     * @param message - message to be processed
     */
    private getResolver;
}
//# sourceMappingURL=Consumer.d.ts.map