interface InvokeBase {
    success: number;
    fail: number;
}
export interface ApiItem<P = any, S = any, F = any> {
    param: P;
    suc: S;
    fail: F;
}
export type ApiMap<K = {}> = {
    [k in keyof K]: ApiItem;
};
export type ApiParam<A extends ApiMap, K extends keyof A, N extends keyof ApiItem> = A[K] extends ApiItem ? A[K][N] : never;
export type InvokeParam<A extends ApiMap, N extends keyof A = keyof A> = ApiParam<A, N, 'fail' | 'suc'>;
export type InvokeHandlerParam<A extends ApiMap, N extends keyof A = keyof A> = ApiParam<A, N, 'param'> & InvokeBase;
export type SubscribeParam<A extends ApiMap, N extends keyof A> = ApiParam<A, N, 'param'> & BaseInput<A, N>;
export interface BaseInput<A extends ApiMap, N extends keyof A = keyof A> {
    success?: (p: ApiParam<A, N, 'suc'>) => void;
    fail?: (p: ApiParam<A, N, 'fail'>) => void;
}
export type HandlerMap<K = {}, H extends Function = Function> = {
    [k in keyof K]: H;
};
export type Param<T> = T extends (p: infer P) => void ? P : never;
export interface SchemaData<K, P> {
    name: K;
    data: P;
}
export declare enum MsgType {
    EVENT = 1,
    INVOKE = 2,
    SUBSCRIBE = 3
}
export type Schema<A extends ApiMap, H extends HandlerMap, N extends keyof A = keyof A> = {
    type: MsgType.INVOKE;
    data: SchemaData<number, InvokeParam<A, N>>;
} | {
    type: MsgType.SUBSCRIBE;
    data: SchemaData<keyof A, InvokeHandlerParam<A, N>>;
} | {
    type: MsgType.EVENT;
    data: SchemaData<keyof H, Param<H[keyof H]>>;
};
export interface Format<A extends ApiMap, H extends HandlerMap, CS = unknown> {
    (type: MsgType.INVOKE, id: number, param: InvokeParam<A, keyof A>): CS;
    <N extends keyof A>(type: MsgType.SUBSCRIBE, name: N, param: InvokeHandlerParam<A, N>): CS;
    <N extends keyof H>(type: MsgType.EVENT, name: N, param: Param<H[N]>): CS;
}
export interface Transform<A extends ApiMap, H extends HandlerMap, CS = unknown> {
    (data: CS): Schema<A, H> | void;
}
export interface Config<A extends ApiMap, H extends HandlerMap, CS = unknown> {
    format?: Format<A, H, CS>;
    transform?: Transform<A, H, CS>;
}
export interface SDK<A extends ApiMap, B = unknown> {
    <N extends keyof A, Bridge extends B>(name: keyof A, param: InvokeHandlerParam<A, N>, bridge: Bridge): void;
}
export interface VscodeApiInstance {
    setState(d: unknown): void;
    getState(): unknown | void;
    postMessage(data: unknown): void;
    onmessage?(fn: (data: unknown) => void): void;
}
export interface AcquireVsCodeApi {
    (): VscodeApiInstance;
}
export {};
