import { RepoRef } from "@atomist/automation-client";
import { SpiderResult } from "../offline/spider/Spider";
interface AnalysisTrackingRepo {
    description: string;
    url?: string;
}
declare type AnalysisProgress = "Going" | "Stopped";
declare type RepoProgress = "Planned" | "Going" | "Stopped";
interface AnalysisForTracking {
    description: string;
    analysisKey: string;
    progress: AnalysisProgress;
}
interface RepoForReporting {
    description: string;
    repoKey: string;
    keptExisting: boolean;
    progress: RepoProgress;
    aspects: AspectForReporting[];
    millisTaken?: number;
    errorMessage?: string;
    stackTrace?: string;
    snapshotId?: string;
}
interface AnalysisForReporting {
    description: string;
    analysisKey: string;
    progress: AnalysisProgress;
    repos: RepoForReporting[];
    error?: Error;
    completedAt?: Date;
}
export interface AnalysisReport {
    analyses: AnalysisForReporting[];
}
export interface AnalysisTracking {
    startAnalysis(params: Pick<AnalysisForTracking, "description">): AnalysisBeingTracked;
    report(): AnalysisReport;
}
export interface FailureDetails {
    whileTryingTo: string;
    error?: Error;
    message?: string;
}
declare type WayToGetFingerprintsFromAnAspect = "extract" | "consolidate";
export interface AspectForReporting {
    aspectName: string;
    visible: boolean;
    stage: WayToGetFingerprintsFromAnAspect;
    millisTaken?: number;
    error?: Error;
    fingerprintsFound: number;
}
/**
 * Track the calculation of fingerprints from one aspect on one repo snapshot
 */
export declare class AspectBeingTracked {
    readonly params: {
        aspectName: string;
        visible: boolean;
        aboutToRun: WayToGetFingerprintsFromAnAspect;
    };
    readonly startedAt: Date;
    completedAt: Date | undefined;
    fingerprintsFound: number | undefined;
    failedWith: Error | undefined;
    moreFailures: Array<{
        error: Error;
        furtherDescription: string;
    }>;
    constructor(params: {
        aspectName: string;
        visible: boolean;
        aboutToRun: WayToGetFingerprintsFromAnAspect;
    });
    isThisYou(aspectName: string): boolean;
    failFingerprint(fp: {
        type: string;
        name: string;
    }, error: Error): void;
    completed(fingerprintsFound: number): void;
    failed(err: Error): void;
    report(): AspectForReporting;
}
export interface AnalysisTrackingAspect {
    name: string;
    displayName: string | undefined;
}
export declare class RepoBeingTracked {
    private readonly params;
    repoRef: RepoRef | undefined;
    millisTaken: number | undefined;
    existingWasKept: boolean;
    persistedSnapshotId: string | undefined;
    failureDetails: FailureDetails | undefined;
    skipReason: string | undefined;
    private analysisStartMillis;
    private readonly aspects;
    constructor(params: {
        description: string;
        url?: string;
        repoKey: string;
    });
    beganAnalysis(): void;
    setRepoRef(repoRef: RepoRef): void;
    keptExisting(): void;
    plan(aspect: AnalysisTrackingAspect, aboutToRun: WayToGetFingerprintsFromAnAspect): AspectBeingTracked;
    failed(failureDetails: FailureDetails): void;
    failFingerprint(fp: {
        type: string;
        name: string;
    }, error: Error): void;
    skipped(skipReason: string): void;
    persisted(snapshotId: string): void;
    report(): RepoForReporting;
    spiderResult(): SpiderResult;
}
export declare class AnalysisBeingTracked {
    readonly me: AnalysisForTracking;
    error?: Error;
    completedAt: Date | undefined;
    private readonly repos;
    constructor(me: AnalysisForTracking);
    private repoCount;
    plan(repo: AnalysisTrackingRepo): RepoBeingTracked;
    stop(): void;
    failed(error: Error): void;
    report(): AnalysisForReporting;
}
/**
 * Track analyses for display of status on a page.
 * You want exactly one of these in your SDM.
 */
export declare class AnalysisTracker implements AnalysisTracking {
    private counter;
    private readonly analyses;
    startAnalysis(params: Pick<AnalysisForTracking, "description">): AnalysisBeingTracked;
    report(): AnalysisReport;
}
export {};
//# sourceMappingURL=analysisTracker.d.ts.map