import type { App } from "..";
import type { EventManager } from "../core/events";
import type { Connection } from "../data/connection";
import type { EntityManager } from "../data/entities";
import type { Hono } from "hono";
import type { ServerEnv } from "../modules/Controller";
import type { ModuleHelper } from "./ModuleHelper";
import { SchemaObject } from "../core/object/SchemaObject";
import type { Guard } from "../auth/authorize/Guard";
import type { McpServer, DebugLogger } from "bknd/utils";
type PartialRec<T> = {
    [P in keyof T]?: PartialRec<T[P]>;
};
export type ModuleBuildContextMcpContext = {
    app: App;
    ctx: () => ModuleBuildContext;
};
export type ModuleBuildContext = {
    connection: Connection;
    server: Hono<ServerEnv>;
    em: EntityManager;
    emgr: EventManager<any>;
    guard: Guard;
    logger: DebugLogger;
    flags: (typeof Module)["ctx_flags"];
    helper: ModuleHelper;
    mcp: McpServer<ModuleBuildContextMcpContext>;
};
export declare abstract class Module<Schema extends object = object> {
    protected _ctx?: ModuleBuildContext | undefined;
    private _built;
    private _schema;
    private _listener;
    constructor(initial?: PartialRec<Schema>, _ctx?: ModuleBuildContext | undefined);
    static ctx_flags: {
        sync_required: boolean;
        ctx_reload_required: boolean;
    };
    onBeforeUpdate(from: Schema, to: Schema): Schema | Promise<Schema>;
    setListener(listener: (c: ReturnType<(typeof this)["getSchema"]>) => void | Promise<void>): this;
    abstract getSchema(): any;
    useForceParse(): boolean;
    getRestrictedPaths(): string[] | undefined;
    /**
     * These paths will be overwritten, even when "patch" is called.
     * This is helpful if there are keys that contains records, which always be sent in full.
     */
    getOverwritePaths(): (RegExp | string)[] | undefined;
    get configDefault(): Schema;
    get config(): Schema;
    setContext(ctx: ModuleBuildContext): this;
    schema(): SchemaObject<ReturnType<this["getSchema"]>>;
    onServerInit(hono: Hono<ServerEnv>): void;
    get ctx(): ModuleBuildContext;
    build(): Promise<void>;
    setBuilt(): void;
    isBuilt(): boolean;
    throwIfNotBuilt(): void;
    toJSON(secrets?: boolean): Schema;
}
export {};
