import { StepOperations } from '@iotize/common/task-manager';
import '@iotize/tap';
import { ServiceCallType, ServiceContainer, Tap } from '@iotize/tap';
import { BundleConfig, TapConfig, TapConfiguratorConfig, TapConfiguratorOptions, VariableConfig, VariableTypeDataConfig } from '@iotize/tap/config/schema/v1';
import '@iotize/tap/service/all';
interface ConfigureContext {
    tap: Tap;
    options: TapConfiguratorOptions;
    tapConfig: TapConfig;
}
export declare function tapConfigToServiceCalls(config: TapConfig, options: {
    firmwareVersion: string;
    service: ServiceContainer;
    saltGenerator?: () => Uint8Array;
}): (ServiceCallType<any, any> | Error)[];
declare type VariableFlatConfig = {
    id: number;
    bundleId: number;
    length: number;
    value: Uint8Array;
    rawMeta?: Uint8Array;
    type: {
        domain: string;
        data: VariableTypeDataConfig;
    };
    modbusAddress?: any;
    address?: number;
    /**
     * For extensions
     */
    [key: string]: any;
};
export declare function encodeInitialVariableValue(variable: VariableConfig, bundle: BundleConfig): Uint8Array;
export declare function toVariableFlatConfig(variable: VariableConfig, bundle: BundleConfig): VariableFlatConfig;
export declare function toFlatTapConfig(config: TapConfig, options?: {
    saltGenerator?: () => Uint8Array;
}): any;
/**
 * Configure tap from a configuration file schema
 *
 */
export declare class TapConfiguratorWriter {
    options: TapConfiguratorWriter.Options;
    host?: TapConfiguratorWriter.Host | undefined;
    constructor(options?: TapConfiguratorWriter.Options, host?: TapConfiguratorWriter.Host | undefined);
    createConfiguratorForTap(tap: Tap, config: TapConfiguratorConfig, options?: TapConfiguratorWriter.ConfigureOptions): Promise<TapConfiguratorWriter.Runner>;
    configure(tap: Tap, firmwareVersion: string, config: TapConfiguratorConfig, options?: TapConfiguratorWriter.ConfigureOptions): TapConfiguratorWriter.Runner;
    setupConfigState(tap: Tap): Promise<void>;
    isConfigured(tap: Tap): Promise<boolean>;
    /***
     *
     */
    applyConfig(tap: Tap, newVersion?: string): Promise<void>;
    protected addConfigurCalls(configureContext: ConfigureContext, calls: (ServiceCallType<any, any> | Error)[], operations: TapConfiguratorWriter.StepOperationType[]): void;
    protected sleep(delayMs: number): Promise<void>;
    private _adaptConfigurationToCurrentVersion;
}
export declare namespace TapConfiguratorWriter {
    interface Event {
        step: Step;
        [key: string]: any;
    }
    interface Options {
        delayMs: number;
        /**
         * If set to true, it will throw an error if when a not implemented tap response occurs
         */
        throwOnNotImplementedConfigKey?: boolean;
    }
    interface ConfigureOptions {
        skipSchemaValidation?: boolean;
    }
    interface Host {
        /**
         * Load given URI
         * Throw error if URI is not found
         * @param uri
         */
        loadUri(uri: string): Promise<{
            buffer: Uint8Array;
        }>;
    }
    enum Step {
        validatesConfig = "TapConfiguratorStepValidatesConfig",
        enableSecureCom = "TapConfiguratorStepenableSecureCommunication",
        factoryReset = "TapConfiguratorStepFactoryReset",
        setupConfigurationState = "TapConfiguratorStepSetupConfigurationState",
        executeCall = "TapConfiguratorStepExecuteCall",
        logout = "TapConfiguratorSteplogout",
        applyConfig = "TapConfiguratorStepApplyConfig",
        writeSecurityOptions = "TapConfiguratorStepWriteSecurityOptions"
    }
    type StepOperationType = StepOperations.OperationType<Event, any>;
    type Runner = StepOperations<Event, any>;
}
export {};
