import { ModuleDesc, ModuleEventMap, ModuleCmdMap, CmdFun, ModuleName } from '../types/protocol';
import { StorageStruct, ProjectStorage, DiffPaths, AppMap, UserStorageData, GlobalStorage } from '../types/storage';
import { AppType } from '../types/commonData';
export declare enum EventEnum {
    StorageChange = "Storage.Change"
}
export interface EventMap extends ModuleEventMap<EventEnum> {
    [EventEnum.StorageChange]: {
        type: '';
        params: DiffPaths;
    };
}
export declare enum CmdEnum {
    Set = "Storage.Set",
    Get = "Storage.Get",
    GetUserConfig = "Storage.GetUserConfig",
    SetUserConfig = "Storage.SetUserConfig",
    InitProject = "Storage.InitProject",
    DeleteCompilePath = "Compile.DeleteCompilePath",
    GetFromDisk = "Storage.GetFromDisk"
}
export type RootKey = keyof StorageStruct;
export type PKey = keyof ProjectStorage;
export type CmdSetP = <N extends PKey>(m: ModuleName.storage, cmd: CmdEnum.Set, compilePath: string, key: N, data: ProjectStorage[N]) => void;
export type CmdSetA = <A extends AppType, K extends keyof AppMap[A]>(m: ModuleName.storage, cmd: CmdEnum.Set, compilePath: string, appType: A, key: K, data: AppMap[A][K]) => void;
export type CmdSet = <N extends RootKey>(m: ModuleName.storage, cmd: CmdEnum.Set, key: N, data: StorageStruct[N]) => void;
export type CmdGetP = <N extends PKey>(m: ModuleName.storage, cmd: CmdEnum.Get, compilePath: string, key: N) => ProjectStorage[N];
export type CmdGetA = <A extends AppType, K extends keyof AppMap[A]>(m: ModuleName.storage, cmd: CmdEnum.Get, compilePath: string, appType: A, key: K) => AppMap[A][K];
export type CmdGet = <N extends RootKey>(m: ModuleName.storage, cmd: CmdEnum.Get, key: N) => StorageStruct[N];
export type CmdInitProject = (m: ModuleName.storage, cmd: typeof CmdEnum.InitProject, compilePath: string) => Promise<ProjectStorage>;
export type CmdInitApp = <A extends AppType>(m: ModuleName.storage, cmd: typeof CmdEnum.InitProject, compilePath: string, appType: A) => Promise<AppMap[A]>;
export type CmdDeleteCompilePath = (m: ModuleName.storage, cmd: CmdEnum.DeleteCompilePath, paths: string[], appType: AppType) => Promise<string[]>;
export type CmdGetUserConfig = (m: ModuleName.storage, cmd: CmdEnum.GetUserConfig, userid: string) => UserStorageData;
export type CmdSetUserConfig = (m: ModuleName.storage, cmd: CmdEnum.SetUserConfig, userid: string, data: UserStorageData) => void;
export type CmdGetFromDisk = <T extends keyof GlobalStorage>(m: ModuleName.storage, cmd: CmdEnum.GetFromDisk, key: T) => GlobalStorage[T];
export type Command = CmdSetUserConfig & CmdGetUserConfig & CmdSetP & CmdSetA & CmdSet & CmdGetP & CmdGetA & CmdGet & CmdInitProject & CmdInitApp & CmdDeleteCompilePath & CmdGetFromDisk;
export interface CmdMap extends ModuleCmdMap<CmdEnum> {
    [CmdEnum.Set]: CmdFun<CmdSetP & CmdSetA & CmdSet>;
    [CmdEnum.Get]: CmdFun<CmdGet & CmdGetA & CmdGetP>;
    [CmdEnum.InitProject]: CmdFun<CmdInitProject & CmdInitApp>;
    [CmdEnum.DeleteCompilePath]: CmdFun<CmdDeleteCompilePath>;
    [CmdEnum.GetUserConfig]: CmdFun<CmdGetUserConfig>;
    [CmdEnum.SetUserConfig]: CmdFun<CmdSetUserConfig>;
    [CmdEnum.GetFromDisk]: CmdFun<CmdGetFromDisk>;
}
export declare const StorageDesc: ModuleDesc<EventMap, CmdMap, ModuleName.service>;
