import { Observable, UnaryFunction, MonoTypeOperatorFunction, OperatorFunction } from 'rxjs';
import { IMotionMasterMessage, MotionMasterMessage, ParameterValueType, StatusKey } from './types';
import { DeviceParameter } from './device-parameter';
import { MotionMasterReqResClient } from './motion-master-req-res-client';
import { NotificationEntry } from './util';
/**
 * Creates an operator that filters Motion Master messages by message ID and extracts
 * a specific status field from the message payload.
 *
 * If a message with the matching ID contains a `systemEvent` status instead of the expected status,
 * an error is thrown. This typically happens when a request refers to an invalid device address.
 *
 * @typeParam T - The type corresponding to the selected status field.
 * @param key - The status field name to extract from the message.
 * @param id - The message ID that identifies the corresponding request/response pair.
 *
 * @returns An operator that emits the resolved status when a matching message arrives.
 *
 * @throws Error
 * Thrown when a SystemEvent status is received while a different status type was expected.
 *
 * @example
 * source$.pipe(
 *   selectMotionMasterMessageStatusByMessageId<'deviceInfo'>('deviceInfo', 'req-123')
 * ).subscribe(info => console.log(info));
 */
export declare function selectMotionMasterMessageStatusByMessageId<T>(key: StatusKey, id?: string): UnaryFunction<Observable<IMotionMasterMessage>, Observable<T>>;
/**
 * Enriches a status object by appending request metadata, including its originating message ID
 * and a resolved request state derived from the status contents.
 *
 * This serves as a post-processing step after a status has been extracted from a message.
 *
 * @typeParam T - The status shape being extended.
 * @param data - Context containing the originating message ID and the status key.
 *
 * @returns An operator that transforms each emitted status into an augmented status object.
 *
 * @example
 * source$.pipe(
 *   extendStatus({ statusKey: 'deviceInfo', messageId: 'req-123' })
 * ).subscribe(status => {
 *   console.log(status.messageId);
 *   console.log(status.request); // e.g. "pending", "succeeded", "failed"
 * });
 */
export declare function extendStatus<T>(data: {
    statusKey: StatusKey;
    messageId: string;
}): UnaryFunction<Observable<T>, Observable<T & {
    messageId: string;
    request: import("./types").RequestStatus;
}>>;
/**
 * Produces a complete request-response processing pipeline for Motion Master messages.
 * This operator:
 * 1. Extracts a specific status type from messages matching the given message ID.
 * 2. Applies a timeout to fail if a response is not received in time.
 * 3. Extends the emitted status with request metadata.
 * 4. Continues emitting until the resolved request state reaches `"succeeded"` or `"failed"`.
 *
 * @typeParam T - Status type being tracked.
 * @param statusKey - The status field name expected in the response.
 * @param requestTimeout - Maximum allowed duration (ms) to wait for the response.
 * @param messageId - Message ID identifying the request/response sequence.
 *
 * @returns Operator that emits request lifecycle updates until completion or failure.
 *
 * @throws Error
 * If requestTimeout is not a number.
 *
 * @example
 * source$.pipe(
 *   transformMotionMasterMessageToStatus('deviceInfo', 5000, 'req-123')
 * ).subscribe(status => {
 *   console.log(status.request);
 * });
 */
export declare function transformMotionMasterMessageToStatus<T>(statusKey: StatusKey, requestTimeout: number, messageId: string): UnaryFunction<Observable<IMotionMasterMessage>, Observable<T & {
    messageId: string;
    request: import("./types").RequestStatus;
}>>;
/**
 * Creates an operator that selects only messages whose topic matches the specified topic
 * and emits the associated data payload.
 *
 * This is commonly used when incoming data arrives as `[topic, payload]` tuples.
 *
 * @typeParam T - The payload type associated with the topic.
 * @param topic - Topic identifier to match.
 *
 * @returns Operator that emits only payloads belonging to the given topic.
 *
 * @example
 * source$.pipe(
 *   selectMotionMasterMessageByTopic<DeviceStatus>('device/status')
 * ).subscribe(status => console.log(status));
 */
export declare function selectMotionMasterMessageByTopic<T>(topic: string): UnaryFunction<Observable<[string, T]>, Observable<T>>;
/**
 * Filters Motion Master messages that contain a specific status field and emits the value
 * of that status field.
 *
 * This operator is useful when the source stream contains heterogeneous message types.
 *
 * @typeParam T - The type corresponding to the selected status entry.
 * @param key - Status field key to extract if present.
 *
 * @returns Operator that emits typed status entries for matching messages.
 *
 * @example
 * source$.pipe(
 *   selectMotionMasterMessageStatusByKey<DeviceInfo>('deviceInfo')
 * ).subscribe(info => console.log(info));
 */
export declare function selectMotionMasterMessageStatusByKey<T>(key: keyof MotionMasterMessage.IStatus): UnaryFunction<Observable<IMotionMasterMessage>, Observable<T>>;
/**
 * Creates an operator that extracts only the raw parameter values from monitoring status messages.
 * If monitoring parameter values are present in the incoming message, each value is converted into
 * its resolved primitive representation (e.g., number, boolean, string) via `getParameterValue`.
 *
 * When a message contains no monitoring payload or parameter value list, an empty array is emitted.
 *
 * @returns An operator that maps an `Observable<IMotionMasterMessage>` to an array of resolved parameter values.
 *
 * @example
 * source$.pipe(
 *   mapMonitoringParameterValuesStatusMessageToParameterValues()
 * ).subscribe(values => {
 *   console.log('Raw parameter values:', values);
 * });
 *
 * @remarks
 * - Does not perform device-level lookup or metadata resolution.
 * - Produces values in the same order as provided by the device.
 */
export declare function mapMonitoringParameterValuesStatusMessageToParameterValues(): UnaryFunction<Observable<IMotionMasterMessage>, Observable<ParameterValueType[]>>;
/**
 * Creates an operator that transforms Motion Master monitoring status messages into a list of
 * resolved `DeviceParameter` objects. For each incoming message, parameter values are extracted,
 * device parameter metadata is resolved using the provided request client, and both pieces of
 * information are merged into a final typed representation.
 *
 * More specifically:
 * - Extracts raw parameter values from a monitoring status message.
 * - Determines the associated device address.
 * - Fetches a parameter info map for that device via `request.resolveDeviceParameterInfoMap(...)`.
 * - Combines resolved metadata (e.g., name, unit, scaling) with current parameter values.
 * - Produces a `DeviceParameter[]` representing the current state.
 *
 * If the incoming message does not include parameter values, an empty array is emitted.
 *
 * @param request - A client used to resolve parameter info metadata per device.
 * @returns Operator that maps a stream of `IMotionMasterMessage` into parameter arrays.
 *
 * @example
 * source$.pipe(
 *   mapMonitoringParameterValuesStatusMessageToDeviceParameters(request)
 * ).subscribe(parameters => {
 *   console.log('Resolved device parameters:', parameters);
 * });
 *
 * @remarks
 * - The operator handles missing or incomplete monitoring payloads gracefully.
 * - The returned parameters contain both identification (index/subindex) and resolved metadata.
 */
export declare function mapMonitoringParameterValuesStatusMessageToDeviceParameters(request: MotionMasterReqResClient): UnaryFunction<Observable<IMotionMasterMessage>, Observable<DeviceParameter[]>>;
/**
 * Returns an operator that completes the source observable when the notifier observable either
 * completes or errors. Unlike `takeUntil`, which reacts only to the notifier’s `next` emissions,
 * this operator also stops the source when the notifier finishes or fails.
 *
 * @typeParam T - The value type of the source observable.
 * @param notifier$ - Observable whose termination (complete or error) will stop the source.
 * @returns A `MonoTypeOperatorFunction` that completes the source when the notifier completes or errors.
 *
 * @example
 * const notifier$ = ajax.getJSON('/config'); // May error or complete
 *
 * source$.pipe(
 *   takeUntilCompleteOrError(notifier$)
 * ).subscribe({
 *   next: console.log,
 *   complete: () => console.log('Stopped due to notifier completing'),
 *   error: console.error
 * });
 *
 * // The subscription to source$ ends as soon as:
 * // 1) notifier$ completes, or
 * // 2) notifier$ errors.
 *
 * // NOTE: Any values emitted by notifier$ are ignored.
 */
export declare function takeUntilCompleteOrError<T>(notifier$: Observable<any>): MonoTypeOperatorFunction<T>;
/**
 * Custom RxJS operator that accumulates notifications with their
 * elapsed time relative to a provided start time.
 *
 * Each emitted notification string is converted into a `NotificationEntry`
 * object, and the operator maintains an array of all previous entries.
 *
 * @param startTime - The timestamp (in milliseconds) to use as the reference
 *   point for calculating elapsed time. Typically obtained via `performance.now()`.
 * @returns An OperatorFunction that transforms an Observable of strings into
 *   an Observable of `NotificationEntry[]`.
 *
 * @example
 * ```ts
 * const startTime = performance.now();
 * notifications$.pipe(withTimeDifference(startTime)).subscribe(entries => {
 *   console.log(entries); // Array of NotificationEntry objects with elapsed time
 * });
 * ```
 */
export declare function withTimeDifference(startTime: number): OperatorFunction<string, NotificationEntry[]>;
