import '@iotize/tap-scripts/ext';
import { Tap } from '@iotize/tap';
import { GlobalEventsService } from '@iotize/ionic';
import { InstructionListType, ProgInstructions, ScriptRunner, ScriptRunnerEvent, ScriptRunnerIO } from '@iotize/tap-scripts';
import { Observable, Subject } from 'rxjs';
import { ScriptFile } from './definitions';
export interface ScriptOutputType {
    level: string;
    message: string;
}
export declare class TapScriptRunnerService {
    events: GlobalEventsService;
    readonly scriptTypes: {
        NORMAL: number;
        CONFIGURATION: number;
    };
    scriptRunner?: ScriptRunner;
    _outputMessages: ScriptOutputType[];
    _errors: Subject<Error>;
    output: Subject<ScriptOutputType[]>;
    get isRunning(): boolean;
    /** The ScriptRunner object is given options with what is done with values retrieved by the script
     * The output property defines the actions to perform on data retrieving.
     * The display property defines how to log informations given back by the scriptRunner.
     * @see {ScriptRunner}
     */
    scriptRunnerOptions: ScriptRunnerIO;
    scriptFile: ScriptFile;
    scriptType: number;
    constructor(events: GlobalEventsService);
    get hasScript(): boolean;
    /**
     * Converts script content, read as a string, into a list of instructions
     * @param scriptString content of the loaded script file
     * @returns
     */
    getProgInstructions(scriptString: string): InstructionListType;
    runScript(instructions: ProgInstructions[], tap: Tap): Observable<ScriptRunnerEvent>;
    stopScript(): void;
    get errors(): Observable<Error>;
    /**
     * Reads and executes the given instruction list.
     * @param instructions
     */
    executeScriptFromInstructions(tap: Tap, instructions: InstructionListType): Observable<ScriptRunnerEvent>;
    stop(): void;
    addOutput(level: string, message: string): void;
    /**
     * Converts, reads and executes instructions from the raw content of a script file.
     * In the configuration routine, script execution is preceded by:
     * - Log as admin
     * - Factory reset
     * - Wait time
     * And succeeded with
     * - Wait time
     * - Configuration reload
     * - Wait time
     *
     * The configuration routine has succeeded if all these steps did.
     *
     * TODO remove as it's in library
     *
     * @param scriptString
     */
    executeConfigurationScriptRoutine(scriptString: string, tap: Tap): Promise<void>;
    /**
     * Executes currently loaded script, if no script is running, using the routine defined by the scriptType property
     */
    executeLoadedScript(tap: Tap): Promise<void> | Observable<ScriptRunnerEvent> | undefined;
    /**
     * Returns a promise that resolve after given time in milliseconds
     * @param milliseconds
     * @returns
     */
    sleep(milliseconds: number): Promise<void>;
}
