import { type JsonObject } from '@rushstack/node-core-library';
import type { ITerminal } from '@rushstack/terminal';
import type { RushConfiguration } from './RushConfiguration';
import { FileSystemBuildCacheProvider } from '../logic/buildCache/FileSystemBuildCacheProvider';
import type { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
import { type GetCacheEntryIdFunction } from '../logic/buildCache/CacheEntryId';
import type { RushSession } from '../pluginFramework/RushSession';
/**
 * Describes the file structure for the "common/config/rush/build-cache.json" config file.
 */
export interface IBaseBuildCacheJson {
    buildCacheEnabled: boolean;
    cacheProvider: string;
    /**
     * Used to specify the cache entry ID format. If this property is set, it must
     * contain a `[hash]` token. It may also contain one of the following tokens:
     * - `[projectName]`
     * - `[projectName:normalize]`
     * - `[phaseName]`
     * - `[phaseName:normalize]`
     * - `[phaseName:trimPrefix]`
     * - `[os]`
     * - `[arch]`
     * @privateRemarks
     * NOTE: If you update this comment, make sure to update build-cache.json in the "rush init" template.
     * The token parser is in CacheEntryId.ts
     */
    cacheEntryNamePattern?: string;
    /**
     * An optional salt to inject during calculation of the cache key. This can be used to invalidate the cache for all projects when the salt changes.
     */
    cacheHashSalt?: string;
}
/**
 * @public
 */
export interface ILocalBuildCacheJson extends IBaseBuildCacheJson {
    readonly cacheProvider: 'local-only';
}
/**
 * @beta
 */
export interface ICloudBuildCacheJson extends IBaseBuildCacheJson {
    readonly cacheProvider: string;
    [otherConfigKey: string]: JsonObject;
}
/**
 * @beta
 */
export type IBuildCacheJson = ICloudBuildCacheJson | ILocalBuildCacheJson;
/**
 * Use this class to load and save the "common/config/rush/build-cache.json" config file.
 * This file provides configuration options for cached project build output.
 * @beta
 */
export declare class BuildCacheConfiguration {
    /**
     * Indicates whether the build cache feature is enabled.
     * Typically it is enabled in the build-cache.json config file.
     */
    readonly buildCacheEnabled: boolean;
    /**
     * Indicates whether or not writing to the cache is enabled.
     */
    cacheWriteEnabled: boolean;
    /**
     * Method to calculate the cache entry id for a project, phase, and project state.
     */
    readonly getCacheEntryId: GetCacheEntryIdFunction;
    /**
     * The provider for interacting with the local build cache.
     */
    readonly localCacheProvider: FileSystemBuildCacheProvider;
    /**
     * The provider for interacting with the cloud build cache, if configured.
     */
    readonly cloudCacheProvider: ICloudBuildCacheProvider | undefined;
    /**
     * An optional salt to inject during calculation of the cache key. This can be used to invalidate the cache for all projects when the salt changes.
     */
    readonly cacheHashSalt: string | undefined;
    private constructor();
    /**
     * Attempts to load the build-cache.json data from the standard file path `common/config/rush/build-cache.json`.
     * If the file has not been created yet, then undefined is returned.
     */
    static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<BuildCacheConfiguration | undefined>;
    /**
     * Loads the build-cache.json data from the standard file path `common/config/rush/build-cache.json`.
     * If the file has not been created yet, or if the feature is not enabled, then an error is reported.
     */
    static loadAndRequireEnabledAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise<BuildCacheConfiguration>;
    /**
     * Gets the absolute path to the build-cache.json file in the specified rush workspace.
     */
    static getBuildCacheConfigFilePath(rushConfiguration: RushConfiguration): string;
    private static _tryLoadInternalAsync;
    private static _tryLoadAsync;
}
//# sourceMappingURL=BuildCacheConfiguration.d.ts.map