import { Decoder, Encoder } from '@iotize/common/converter/api';
import { BodyDecoder, Command, EncryptionAlgo, IoTizeClient, RequestInterceptorType, ResponseInterface } from '@iotize/device-client.js/client/api';
import { ApiRequest, DefaultIoTizeClient, Response } from '@iotize/device-client.js/client/impl';
import { ComProtocol, ConnectionStateChangeEvent } from '@iotize/device-client.js/protocol/api';
import { Observable } from 'rxjs';
import { Predicate, ResponseAdapterFunction } from './definitions';
import { MockProtocol } from './mock-protocol';
import { Router } from './util';
/**
 * Mock client options to configure fake delay for connect/disconnect and send operations
 */
export interface MockClientOptions {
    connect: {
        delay: number;
    };
    disconnect: {
        delay: number;
    };
    command: {
        delay: number;
    };
    encryption: boolean;
}
export interface MappingType {
    [key: string]: ResponseMapType;
}
export declare type ResponseMapType = Response<any> | ResponseInterface<any> | string | number | {
    codeRet: number;
    body?: any;
} | ResponseAdapterFunction<any>;
export declare type CommandFilter = Predicate<Command> | ((command: Command) => boolean);
export declare class MockClient implements IoTizeClient {
    static DEFAULT_OPTIONS: MockClientOptions;
    options: MockClientOptions;
    protected _isConnected: boolean;
    _router: Router;
    encryptionAlgo?: EncryptionAlgo;
    private _protocol?;
    constructor(mapping?: any, options?: MockClientOptions);
    commandEncoder: Encoder<ApiRequest, Uint8Array>;
    responseDecoder: Decoder<Uint8Array, ResponseInterface<any>>;
    addInterceptor(interceptor: RequestInterceptorType): this;
    isEncryptionEnabled(): boolean;
    /**
     *
     * TOPO add support for parameters ?
     * TODO use Shell Grammar instead ?
     *
     * @param map
     */
    static createFromMap(map: MappingType): MockClient;
    static fromMockProtocol(protocol: MockProtocol): DefaultIoTizeClient;
    get router(): Router;
    isConnected(): boolean;
    onConnectionStateChange(): Observable<ConnectionStateChangeEvent>;
    addComProtocol(newProtocol: ComProtocol, id: string): this;
    switchProtocol(type: string): this;
    getCurrentProtocol(): ComProtocol;
    connect(): Observable<any>;
    disconnect(): Observable<any>;
    command<T>(request: Command, bodyDecoder?: BodyDecoder<T>): Observable<Response<T>>;
    useComProtocol(protocol: string | ComProtocol): this;
    send<T>(dataIn: Uint8Array, bodyDecoder?: BodyDecoder<T>): Observable<Response<T>>;
    /**
     * @deprecated in favor of addRoute
     * @param cmd
     * @param response
     */
    mapCommandToResponse(cmd: Command, response: Response<any>): this;
    addRoute<T>(command: Command | string | RegExp | CommandFilter, response: ResponseMapType): this;
    addRoutes(map: MappingType): this;
    hasRoute(command: Command | string): boolean;
    setEncryptionAlgo(algo: EncryptionAlgo): void;
    getEncryptionAlgo(): EncryptionAlgo;
    enableEncryption(value: boolean): Promise<any>;
    createResponse<T>(command: Command | CommandFilter, info: ResponseMapType): ResponseInterface<T> | ResponseAdapterFunction<any>;
    protected computeResponse(cmd: Command): Response<any>;
}
