import { TestStatus, ToolName } from '../constants';
import { ReporterTestResult } from '../test-adapter';
import { ErrorDetails, ImageInfoFull } from '../types';
import { TreeTestResultTransformer } from '../test-adapter/transformers/tree';
import { DbTestResult } from '../sqlite-client';
export type BaseTreeTestResult = Omit<DbTestResult, 'imagesInfo'> & {
    attempt?: number;
    errorDetails?: ErrorDetails | null;
};
export interface TreeTestResult extends BaseTreeTestResult {
    id: string;
    parentId: string;
    imageIds: string[];
    attempt: number;
}
interface TreeBrowser {
    id: string;
    name: string;
    parentId: string;
    resultIds: string[];
    version: string;
}
export interface TreeSuite {
    status?: TestStatus;
    id: string;
    parentId: string | null;
    name: string;
    suitePath: string[];
    root: boolean;
    suiteIds?: string[];
    browserIds?: string[];
}
export type TreeImage = {
    id: string;
    parentId: string;
} & ImageInfoFull;
export interface Tree {
    suites: {
        byId: Record<string, TreeSuite>;
        allIds: string[];
        allRootIds: string[];
    };
    browsers: {
        byId: Record<string, TreeBrowser>;
        allIds: string[];
    };
    results: {
        byId: Record<string, TreeTestResult>;
        allIds: string[];
    };
    images: {
        byId: Record<string, TreeImage>;
        allIds: string[];
    };
}
interface ResultPayload {
    id: string;
    parentId: string;
    result: ReporterTestResult;
}
interface BrowserPayload {
    id: string;
    name: string;
    parentId: string;
    version: string;
}
interface ImagesPayload {
    imagesInfo: ImageInfoFull[];
    parentId: string;
}
export interface BaseTestsTreeBuilderOptions {
    toolName: ToolName;
    baseHost: string;
}
export declare class BaseTestsTreeBuilder {
    protected _tree: Tree;
    protected _toolName: ToolName;
    protected _transformer: TreeTestResultTransformer;
    static create<T extends BaseTestsTreeBuilder>(this: new (options: BaseTestsTreeBuilderOptions) => T, options: BaseTestsTreeBuilderOptions): T;
    constructor({ toolName, baseHost }: BaseTestsTreeBuilderOptions);
    get tree(): Tree;
    sortTree(): void;
    addTestResult(formattedResult: ReporterTestResult): void;
    protected _buildId(parentId?: string | string[], name?: string | string[]): string;
    protected _addSuites(testPath: string[], browserId: string): void;
    protected _addSuite(suite: TreeSuite): void;
    protected _addNodeId(parentSuiteId: string, nodeId: string, { fieldName }: {
        fieldName: 'browserIds' | 'suiteIds';
    }): void;
    protected _isNodeIdExists(parentSuiteId: string, nodeId: string, { fieldName }: {
        fieldName: 'browserIds' | 'suiteIds';
    }): boolean;
    protected _addBrowser({ id, parentId, name, version }: BrowserPayload, testResultId: string, attempt: number): void;
    protected _addResultIdToBrowser(browserId: string, testResultId: string, attempt: number): void;
    protected _addResult({ id, parentId, result }: ResultPayload, imageIds: string[]): void;
    protected _addImages(imageIds: string[], { imagesInfo, parentId }: ImagesPayload): void;
    protected _setStatusForBranch(testPath?: string[]): void;
}
export {};
