import { Cache, RecursivePartial, StateCallback, StateEvents, StateObject, StatePropCallback, StringAnyMap, XMLNode } from "@hpcc-js/util";
import { IConnection, IOptions } from "../connection";
import { WsSMC } from "../services/wsSMC";
import * as WsTopology from "../services/wsTopology";
import { WsWorkunits, WUStateID, WorkunitsService, WUUpdate } from "../services/wsWorkunits";
import { ECLGraph, ScopeGraph, XGMMLGraph } from "./graph";
import { Resource } from "./resource";
import { Result } from "./result";
import { BaseScope, Scope } from "./scope";
import { SourceFile } from "./sourceFile";
import { Timer } from "./timer";
export declare const PropertyType: string[];
export declare const RelatedProperty: string[];
export interface IPropertyValue {
    Key: string;
    Value?: string;
    Avg?: string;
    Min?: string;
    Max?: string;
    Delta?: string;
    StdDev?: string;
    StdDevs?: number;
    SkewMin?: string;
    SkewMax?: string;
    NodeMin?: string;
    NodeMax?: string;
}
export interface IScope {
    __parentName?: string;
    __children?: IScope[];
    __formattedProps: {
        [key: string]: any;
    };
    __groupedProps: {
        [key: string]: IPropertyValue;
    };
    __StdDevs: number;
    __StdDevsSource: string;
    id: string;
    name: string;
    type: string;
    Kind: string;
    Label: string;
    [key: string]: any;
}
export interface ISplitMetric {
    measure: string;
    ext: string;
    label: string;
}
export declare function splitMetric(key: string): ISplitMetric;
export declare class WorkunitCache extends Cache<{
    BaseUrl: string;
    Wuid: string;
}, Workunit> {
    constructor();
}
export interface DebugState {
    sequence: number;
    state: string;
    [key: string]: any;
}
export interface IWorkunit {
    ResultViews: WsWorkunits.ResultViews;
    HelpersCount: number;
}
export interface IDebugWorkunit {
    DebugState?: DebugState;
}
export interface ITimeElapsed {
    scope: string;
    start: string;
    elapsed: number;
    finish: string;
}
export type WorkunitEvents = "completed" | StateEvents;
export type UWorkunitState = WsWorkunits.ECLWorkunit & WsWorkunits.Workunit & WsSMC.ActiveWorkunit & IWorkunit & IDebugWorkunit;
export type IWorkunitState = WsWorkunits.ECLWorkunit | WsWorkunits.Workunit | WsSMC.ActiveWorkunit | IWorkunit | IDebugWorkunit;
export declare class Workunit extends StateObject<UWorkunitState, IWorkunitState> implements WsWorkunits.Workunit {
    connection: WorkunitsService;
    topologyConnection: WsTopology.TopologyService;
    readonly BaseUrl: string;
    private _debugMode;
    private _debugAllGraph;
    private _submitAction;
    readonly properties: WsWorkunits.ECLWorkunit & WsWorkunits.Workunit;
    readonly Wuid: string;
    readonly Owner: string;
    readonly Cluster: string;
    readonly Jobname: string;
    readonly Description: string;
    readonly ActionEx: string;
    readonly StateID: WUStateID;
    readonly State: string;
    readonly Protected: boolean;
    readonly Exceptions: WsWorkunits.Exceptions2;
    readonly ResultViews: WsWorkunits.ResultViews;
    private _resultCache;
    readonly ResultCount: number;
    readonly Results: WsWorkunits.Results;
    readonly CResults: Result[];
    readonly SequenceResults: {
        [key: number]: Result;
    };
    readonly Timers: WsWorkunits.Timers;
    readonly CTimers: Timer[];
    private _graphCache;
    readonly GraphCount: number;
    readonly Graphs: WsWorkunits.Graphs;
    readonly CGraphs: ECLGraph[];
    readonly ThorLogList: WsWorkunits.ThorLogList;
    readonly ResourceURLCount: number;
    readonly ResourceURLs: WsWorkunits.ResourceURLs;
    readonly CResourceURLs: Resource[];
    readonly TotalClusterTime: string;
    readonly DateTimeScheduled: string;
    readonly IsPausing: boolean;
    readonly ThorLCR: boolean;
    readonly ApplicationValues: WsWorkunits.ApplicationValues;
    readonly HasArchiveQuery: boolean;
    readonly StateEx: string;
    readonly PriorityClass: number;
    readonly PriorityLevel: number;
    readonly Snapshot: string;
    readonly ResultLimit: number;
    readonly EventSchedule: number;
    readonly Query: WsWorkunits.Query;
    readonly HelpersCount: number;
    readonly Helpers: WsWorkunits.Helpers;
    readonly DebugValues: WsWorkunits.DebugValues;
    readonly AllowedClusters: WsWorkunits.AllowedClusters;
    readonly ErrorCount: number;
    readonly WarningCount: number;
    readonly InfoCount: number;
    readonly AlertCount: number;
    readonly SourceFileCount: number;
    readonly SourceFiles: WsWorkunits.SourceFiles;
    readonly CSourceFiles: SourceFile[];
    readonly VariableCount: number;
    readonly Variables: WsWorkunits.Variables;
    readonly TimerCount: number;
    readonly HasDebugValue: boolean;
    readonly ApplicationValueCount: number;
    readonly XmlParams: string;
    readonly AccessFlag: number;
    readonly ClusterFlag: number;
    readonly ResultViewCount: number;
    readonly DebugValueCount: number;
    readonly WorkflowCount: number;
    readonly Archived: boolean;
    readonly RoxieCluster: string;
    readonly DebugState: DebugState;
    readonly Queue: string;
    readonly Active: boolean;
    readonly Action: number;
    readonly Scope: string;
    readonly AbortBy: string;
    readonly AbortTime: string;
    readonly Workflows: WsWorkunits.Workflows;
    readonly TimingData: WsWorkunits.TimingData;
    readonly HelpersDesc: string;
    readonly GraphsDesc: string;
    readonly SourceFilesDesc: string;
    readonly ResultsDesc: string;
    readonly VariablesDesc: string;
    readonly TimersDesc: string;
    readonly DebugValuesDesc: string;
    readonly ApplicationValuesDesc: string;
    readonly WorkflowsDesc: string;
    readonly ServiceNames: WsWorkunits.ServiceNames;
    readonly CompileCost: number;
    readonly ExecuteCost: number;
    readonly FileAccessCost: number;
    readonly NoAccess: boolean;
    readonly ECLWUProcessList: WsWorkunits.ECLWUProcessList;
    static create(optsConnection: IOptions | IConnection): Promise<Workunit>;
    static attach(optsConnection: IOptions | IConnection, wuid: string, state?: IWorkunitState): Workunit;
    static existsLocal(baseUrl: string, wuid: string): boolean;
    static submit(server: IOptions | IConnection, target: string, ecl: string, compileOnly?: boolean): Promise<Workunit>;
    static compile(server: IOptions | IConnection, target: string, ecl: string): Promise<Workunit>;
    static query(server: IOptions | IConnection, opts: Partial<WsWorkunits.WUQuery>): Promise<Workunit[]>;
    protected constructor(optsConnection: IOptions | IConnection, wuid?: string);
    clearState(wuid?: string): void;
    update(request: Partial<WsWorkunits.WUUpdate>): Promise<Workunit>;
    submit(_cluster?: string, action?: WUUpdate.Action, resultLimit?: number): Promise<Workunit>;
    isComplete(): boolean;
    isFailed(): boolean;
    isDeleted(): boolean;
    isDebugging(): boolean;
    isRunning(): boolean;
    setToFailed(): Promise<WsWorkunits.WUActionResponse>;
    pause(): Promise<WsWorkunits.WUActionResponse>;
    pauseNow(): Promise<WsWorkunits.WUActionResponse>;
    resume(): Promise<WsWorkunits.WUActionResponse>;
    abort(): Promise<WsWorkunits.WUActionResponse>;
    protect(): Promise<WsWorkunits.WUActionResponse>;
    unprotect(): Promise<WsWorkunits.WUActionResponse>;
    delete(): Promise<WsWorkunits.WUActionResponse>;
    restore(): Promise<WsWorkunits.WUActionResponse>;
    deschedule(): Promise<WsWorkunits.WUActionResponse>;
    reschedule(): Promise<WsWorkunits.WUActionResponse>;
    resubmit(): Promise<Workunit>;
    clone(): Promise<Workunit>;
    refreshState(): Promise<this>;
    refreshInfo(request?: Partial<WsWorkunits.WUInfo>): Promise<this>;
    refreshDebug(): Promise<this>;
    refresh(full?: boolean, request?: Partial<WsWorkunits.WUInfo>): Promise<this>;
    eclExceptions(): WsWorkunits.ECLException[];
    fetchArchive(): Promise<string>;
    fetchECLExceptions(): Promise<WsWorkunits.ECLException[]>;
    fetchResults(): Promise<Result[]>;
    fetchGraphs(): Promise<ECLGraph[]>;
    fetchQuery(): Promise<WsWorkunits.Query>;
    fetchHelpers(): Promise<WsWorkunits.ECLHelpFile[]>;
    fetchAllowedClusters(): Promise<string[]>;
    fetchTotalClusterTime(): Promise<string>;
    fetchServiceNames(): Promise<string[]>;
    fetchDetailsMeta(request?: RecursivePartial<WsWorkunits.WUDetailsMeta>): Promise<WsWorkunits.WUDetailsMetaResponse>;
    fetchDetailsRaw(request?: RecursivePartial<WsWorkunits.WUDetails>): Promise<WsWorkunits.Scope[]>;
    normalizeDetails(meta: WsWorkunits.WUDetailsMetaResponse, scopes: WsWorkunits.Scope[]): {
        meta: WsWorkunits.WUDetailsMetaResponse;
        columns: {
            [id: string]: any;
        };
        data: IScope[];
    };
    fetchDetailsNormalized(request?: RecursivePartial<WsWorkunits.WUDetails>): Promise<{
        meta: WsWorkunits.WUDetailsMetaResponse;
        columns: {
            [id: string]: any;
        };
        data: IScope[];
    }>;
    fetchInfo(request?: Partial<WsWorkunits.WUInfo>): Promise<WsWorkunits.WUInfoResponse>;
    fetchDetails(request?: RecursivePartial<WsWorkunits.WUDetails>): Promise<Scope[]>;
    fetchDetailsHierarchy(request?: Partial<WsWorkunits.WUDetails>): Promise<Scope[]>;
    fetchGraphDetails(graphIDs: string[], rootTypes: string[]): Promise<BaseScope[]>;
    fetchScopeGraphs(graphIDs?: string[]): Promise<ScopeGraph>;
    fetchTimeElapsed(): Promise<ITimeElapsed[]>;
    protected _monitor(): void;
    protected _monitorTimeoutDuration(): number;
    on(eventID: WorkunitEvents, propIDorCallback: StateCallback | keyof UWorkunitState, callback?: StatePropCallback): this;
    watchUntilComplete(callback?: StateCallback): Promise<this>;
    watchUntilRunning(callback?: StateCallback): Promise<this>;
    protected WUQuery(_request?: Partial<WsWorkunits.WUQuery>): Promise<WsWorkunits.WUQueryResponse>;
    protected WUCreate(): Promise<WsWorkunits.WUCreateResponse>;
    protected WUInfo(_request?: Partial<WsWorkunits.WUInfo>): Promise<WsWorkunits.WUInfoResponse>;
    protected WUResubmit(request: Partial<WsWorkunits.WUResubmit>): Promise<WsWorkunits.WUResubmitResponse>;
    protected WUDetailsMeta(request: Partial<WsWorkunits.WUDetailsMeta>): Promise<WsWorkunits.WUDetailsMetaResponse>;
    protected WUDetails(request: RecursivePartial<WsWorkunits.WUDetails>): Promise<WsWorkunits.WUDetailsResponse>;
    protected WUAction(actionType: WsWorkunits.ECLWUActions): Promise<WsWorkunits.WUActionResponse>;
    publish(name?: string): Promise<WsWorkunits.WUPublishWorkunitResponse>;
    publishEx(request: Partial<WsWorkunits.WUPublishWorkunit>): Promise<WsWorkunits.WUPublishWorkunitResponse>;
    protected WUCDebug(command: string, opts?: any): Promise<XMLNode | null>;
    debug(command: string, opts?: object): Promise<XMLNode>;
    debugStatus(): Promise<XMLNode>;
    debugContinue(mode?: string): Promise<XMLNode>;
    debugStep(mode: string): Promise<XMLNode>;
    debugPause(): Promise<XMLNode>;
    debugQuit(): Promise<XMLNode>;
    debugDeleteAllBreakpoints(): Promise<XMLNode>;
    protected debugBreakpointResponseParser(rootNode: StringAnyMap): any;
    debugBreakpointAdd(id: string, mode: string, action: string): Promise<XMLNode>;
    debugBreakpointList(): Promise<any[]>;
    debugGraph(): Promise<XGMMLGraph>;
    debugBreakpointValid(path: string): Promise<IECLDefintion[]>;
    debugPrint(edgeID: string, startRow?: number, numRows?: number): Promise<StringAnyMap[]>;
}
export interface IECLDefintion {
    id: string;
    file: string;
    line: number;
    column: number;
}
//# sourceMappingURL=workunit.d.ts.map
