import { Writable } from 'node:stream';
import type { FastifyInstance, FastifyLoggerOptions, FastifyReply, FastifyRequest, FastifyServerOptions, RawServerDefault } from 'fastify';
import type { ClientErrorResponseBody, ClientRuntimeInfo, ClientValidator, ClientValidationFailure, ClientGuard, NormalizedClientRuntimeInfo } from '../types';
declare module 'fastify' {
    interface FastifyRequest {
        clientRuntime?: NormalizedClientRuntimeInfo;
        requestLogContext?: {
            userId?: string;
            roomId?: string;
        };
    }
}
export declare function setRequestLogContext(request: FastifyRequest, input: {
    userId?: string | number | null;
    roomId?: string | number | null;
}): void;
export declare function buildFastifyLogger(service: string): (FastifyLoggerOptions<RawServerDefault, FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>, FastifyReply<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>> & {
    base: Record<string, unknown>;
    messageKey: string;
    formatters: {
        level(label: string): {
            level: string;
        };
    };
    timestamp: () => string;
    stream?: Writable;
}) | {
    stream: Writable;
    serializers?: {
        req?: (req: FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>) => {
            method?: string;
            url?: string;
            version?: string;
            host?: string;
            remoteAddress?: string;
            remotePort?: number;
            [key: string]: unknown;
        };
        err?: (err: import("fastify").FastifyError) => {
            type: string;
            message: string;
            stack: string;
            [key: string]: unknown;
        };
        res?: (res: import("fastify/types/logger").ResSerializerReply<RawServerDefault, FastifyReply<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>>) => {
            statusCode?: string | number;
            [key: string]: unknown;
        };
    };
    level?: string;
    file?: string;
    genReqId?: (req: FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>) => string;
    base: Record<string, unknown>;
    messageKey: string;
    formatters: {
        level(label: string): {
            level: string;
        };
    };
    timestamp: () => string;
};
export declare function buildFastifyServerOptions(params: {
    service: string;
    bodyLimit?: number;
    trustProxy?: FastifyServerOptions<RawServerDefault>['trustProxy'];
}): FastifyServerOptions<RawServerDefault>;
export declare function registerStructuredRequestLogging(app: FastifyInstance): void;
export declare function readClientHeaders(request: FastifyRequest): ClientRuntimeInfo;
export declare function formatClientError(failure: ClientValidationFailure): ClientErrorResponseBody;
export declare function buildClientGuard(reader?: (request: FastifyRequest) => ClientRuntimeInfo, validator?: ClientValidator, formatter?: (failure: ClientValidationFailure) => ClientErrorResponseBody): ClientGuard;
export declare const ensureSupportedClient: ClientGuard;
//# sourceMappingURL=fastify.d.ts.map