import type { Guard } from "../auth";
import { type DebugLogger, SchemaObject } from "../core";
import type { EventManager } from "../core/events";
import type { Static, TSchema } from "../core/utils";
import { type Connection, type EntityIndex, type EntityManager, type Field, FieldPrototype, type em as prototypeEm } from "../data";
import { Entity } from "../data";
import type { Hono } from "hono";
import type { ServerEnv } from "../modules/Controller";
export type ModuleBuildContext = {
    connection: Connection;
    server: Hono<ServerEnv>;
    em: EntityManager;
    emgr: EventManager<any>;
    guard: Guard;
    logger: DebugLogger;
    flags: (typeof Module)["ctx_flags"];
};
export declare abstract class Module<Schema extends TSchema = TSchema, ConfigSchema = Static<Schema>> {
    protected _ctx?: ModuleBuildContext | undefined;
    private _built;
    private _schema;
    private _listener;
    constructor(initial?: Partial<Static<Schema>>, _ctx?: ModuleBuildContext | undefined);
    static ctx_flags: {
        sync_required: boolean;
        ctx_reload_required: boolean;
    };
    onBeforeUpdate(from: ConfigSchema, to: ConfigSchema): ConfigSchema | Promise<ConfigSchema>;
    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(): Static<ReturnType<(typeof this)["getSchema"]>>;
    get config(): Static<ReturnType<(typeof this)["getSchema"]>>;
    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): Static<ReturnType<(typeof this)["getSchema"]>>;
    protected ensureEntity(entity: Entity): void;
    protected ensureIndex(index: EntityIndex): void;
    protected ensureSchema<Schema extends ReturnType<typeof prototypeEm>>(schema: Schema): Schema;
    protected setEntityFieldConfigs(parent: Field, child: Field, props?: string[]): number;
    protected replaceEntityField(_entity: string | Entity, field: Field | string, _newField: Field | FieldPrototype): void;
}
