import { CacheAction } from "./cache-action";
import { IAssetOptimizer } from "../asset-optimizer/i-asset-optimizer";
import { ICacherExecuteOptions } from "./i-cacher-execute-options";
import { IChecksumPayload } from "./i-checksum-payload";
import { IChecksumInputPayload } from "./i-checksum-input-payload";
import { IManifestJsonParser } from "../parser/manifest-json-parser/i-manifest-json-parser";
import { IIndexHtmlParser } from "../parser/index-html-parser/i-index-html-parser";
import { IConfigParser } from "../parser/config-parser/i-config-parser";
import { IBundler } from "../bundler/i-bundler";
import { ICacherOptions } from "./i-cacher-options";
export declare type FirstArgumentType<T extends (...args: any[]) => any> = T extends (arg: infer R) => any ? R : any;
export declare type SecondArgumentType<T extends (...args: any[]) => any> = T extends (arg1: any, arg2: infer R) => any ? R : any;
export declare type ThirdArgumentType<T extends (...args: any[]) => any> = T extends (arg1: any, arg2: any, arg3: infer R) => any ? R : any;
export declare type StripPromise<T> = T extends Promise<infer U> ? U : Promise<T>;
export interface IRollupCacheActionToHandler {
    [CacheAction.PARSE_MANIFEST_JSON]: IManifestJsonParser["parse"];
    [CacheAction.PARSE_INDEX_HTML]: IIndexHtmlParser["parse"];
    [CacheAction.PARSE_CONFIG]: IConfigParser["parse"];
    [CacheAction.GENERATE_BUNDLE]: IBundler["generate"];
}
export interface ICacheActionToHandler extends IRollupCacheActionToHandler {
    [CacheAction.GENERATE_APP_ICONS]: IAssetOptimizer["generateAppIcons"];
    [CacheAction.OPTIMIZE_ASSETS]: IAssetOptimizer["optimizeDirectory"];
    [CacheAction.STORE_HASH]: string;
}
export interface IRollupCacheActionToArgumentOptions {
    [CacheAction.PARSE_MANIFEST_JSON]: FirstArgumentType<IRollupCacheActionToHandler[CacheAction.PARSE_MANIFEST_JSON]>;
    [CacheAction.PARSE_INDEX_HTML]: FirstArgumentType<IRollupCacheActionToHandler[CacheAction.PARSE_INDEX_HTML]>;
    [CacheAction.PARSE_CONFIG]: FirstArgumentType<IRollupCacheActionToHandler[CacheAction.PARSE_CONFIG]>;
    [CacheAction.GENERATE_BUNDLE]: FirstArgumentType<IRollupCacheActionToHandler[CacheAction.GENERATE_BUNDLE]>;
}
export interface ICacheActionToArgumentOptions extends IRollupCacheActionToArgumentOptions {
    [CacheAction.GENERATE_APP_ICONS]: FirstArgumentType<ICacheActionToHandler[CacheAction.GENERATE_APP_ICONS]>;
    [CacheAction.OPTIMIZE_ASSETS]: FirstArgumentType<ICacheActionToHandler[CacheAction.OPTIMIZE_ASSETS]>;
    [CacheAction.STORE_HASH]: ICacheActionToHandler[CacheAction.STORE_HASH];
}
export interface IRollupCacheActionToReturnType {
    [CacheAction.PARSE_MANIFEST_JSON]: StripPromise<ReturnType<IRollupCacheActionToHandler[CacheAction.PARSE_MANIFEST_JSON]>>;
    [CacheAction.PARSE_INDEX_HTML]: StripPromise<ReturnType<IRollupCacheActionToHandler[CacheAction.PARSE_INDEX_HTML]>>;
    [CacheAction.PARSE_CONFIG]: StripPromise<ReturnType<IRollupCacheActionToHandler[CacheAction.PARSE_CONFIG]>>;
    [CacheAction.GENERATE_BUNDLE]: StripPromise<ReturnType<IRollupCacheActionToHandler[CacheAction.GENERATE_BUNDLE]>>;
}
export interface ICacheActionToReturnType extends IRollupCacheActionToReturnType {
    [CacheAction.GENERATE_APP_ICONS]: StripPromise<ReturnType<ICacheActionToHandler[CacheAction.GENERATE_APP_ICONS]>>;
    [CacheAction.OPTIMIZE_ASSETS]: StripPromise<ReturnType<ICacheActionToHandler[CacheAction.OPTIMIZE_ASSETS]>>;
    [CacheAction.STORE_HASH]: ICacheActionToHandler[CacheAction.STORE_HASH];
}
export interface IRollupCacheActionToChecksumPayload {
    [CacheAction.PARSE_MANIFEST_JSON]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_MANIFEST_JSON]>;
    [CacheAction.PARSE_INDEX_HTML]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_INDEX_HTML]>;
    [CacheAction.PARSE_CONFIG]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_CONFIG]>;
    [CacheAction.GENERATE_BUNDLE]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.GENERATE_BUNDLE]>;
}
export interface ICacheActionToChecksumPayload extends IRollupCacheActionToChecksumPayload {
    [CacheAction.GENERATE_APP_ICONS]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.GENERATE_APP_ICONS]>;
    [CacheAction.OPTIMIZE_ASSETS]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.OPTIMIZE_ASSETS]>;
    [CacheAction.STORE_HASH]: IChecksumPayload<ICacheActionToArgumentOptions[CacheAction.STORE_HASH]>;
}
export interface IRollupCacheActionToChecksumInputPayload {
    [CacheAction.PARSE_MANIFEST_JSON]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_MANIFEST_JSON]>;
    [CacheAction.PARSE_INDEX_HTML]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_INDEX_HTML]>;
    [CacheAction.PARSE_CONFIG]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.PARSE_CONFIG]>;
    [CacheAction.GENERATE_BUNDLE]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.GENERATE_BUNDLE]>;
}
export interface ICacheActionToChecksumInputPayload extends IRollupCacheActionToChecksumInputPayload {
    [CacheAction.GENERATE_APP_ICONS]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.GENERATE_APP_ICONS]>;
    [CacheAction.OPTIMIZE_ASSETS]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.OPTIMIZE_ASSETS]>;
    [CacheAction.STORE_HASH]: IChecksumInputPayload<ICacheActionToArgumentOptions[CacheAction.STORE_HASH]>;
}
export interface ICacher {
    execute<T extends keyof ICacheActionToArgumentOptions>(action: T, args: ICacheActionToArgumentOptions[T], options: ICacherExecuteOptions<ICacheActionToHandler[T]>): Promise<ICacheActionToReturnType[T]>;
    getFromCache<T extends keyof ICacheActionToArgumentOptions>(action: T, options: ICacherOptions): Promise<ICacheActionToReturnType[T] | undefined>;
}
