import { Observable } from "rxjs";
import { Predicate, ResponseAdapterFunction } from "../../protocol/impl/mock/definitions";
import { IoTizeClient } from "../api/iotize-client.interface";
import { Command } from "../api/request/command";
import { EncryptionAlgo } from "../api/encryption-algo.interface";
import { ComProtocol, ConnectionStateChangeEvent } from "../../protocol/api";
import { Router } from "../../protocol/impl/mock/util";
import { MockProtocol } from "../../protocol/impl/mock/mock-protocol";
import { DefaultIoTizeClient } from "./default-iotize-client";
import { BodyDecoder } from "../api/converter";
import { ApiRequest } from "./request/api-request";
import { Response as ResponseInterface } from "../../client/api/response/response.interface";
import { Response } from "../../client/impl/response/response";
import { RequestInterceptorType } from "./interceptors";
import { Decoder, Encoder } from "src/core";
/**
 * 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 declare type MappingType = {
    [key: string]: ResponseMapType;
};
export declare type ResponseMapType = ResponseInterface<any> | string | number | {
    codeRet: number;
    body?: any;
} | ((command: Command) => ResponseInterface<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<Command, 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;
    readonly 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: ApiRequest, 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: ApiRequest): Response<any>;
}
