import * as http2 from 'http2';
import * as http from 'http';
import Application, { Middleware } from 'koa';
import { Strategy } from './plugin.js';

declare const LifeCycleConfig: {
    hooks: {
        init: any[];
        before: any[];
        load: any[];
        after: any[];
        default: (ctx: any, next: any) => Promise<void>;
    };
    before: (server: BaseRpcServer) => Promise<void>;
    init: (server: BaseRpcServer) => Promise<void>;
    load: (server: BaseRpcServer) => Promise<void>;
    after: (server: BaseRpcServer) => Promise<void>;
};
interface IRpcServerConfig {
    name?: string | 'tomapp';
    hooks?: {
        init: Array<Middleware>;
        before: Array<Middleware>;
        load: Array<Middleware>;
        after: Array<Middleware>;
        default(): Promise<Middleware>;
    };
    before?(server: BaseRpcServer): Promise<void>;
    init?(server: BaseRpcServer): Promise<void>;
    load?(server: BaseRpcServer): Promise<void>;
    after?(server: BaseRpcServer): Promise<void>;
}
/**
 * @type {RpcServer} The Server maintains a server to bind one of the Strategy
 * objects. The Server does not know the concrete class of a strategy. It
 * should work with all strategies via the Strategy interface.
 */
declare class BaseRpcServer {
    private plugins;
    app: Application;
    use: any;
    proxy: {
        init: any[];
        load: any[];
        before: {};
    };
    config: any;
    init: [];
    load: [];
    /**
     * Usually, the Server accepts a strategy through the constructor, but also
     * provides a setter to change it at runtime.
     */
    constructor(cfg?: IRpcServerConfig);
    /**
     * Usually, the Server allows replacing a Strategy object at runtime.
     */
    plugin(strategy: Strategy): void;
    mount(): void;
    /**
     * make app ready, add before hook & mount & after hook
     */
    private prepare;
    callback(): (req: http.IncomingMessage | http2.Http2ServerRequest, res: http2.Http2ServerResponse | http.ServerResponse<http.IncomingMessage>) => Promise<void>;
    /**
     * Start @tomrpc/core server with port
     */
    start(port?: number): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
}

export { BaseRpcServer, type IRpcServerConfig, LifeCycleConfig };
