import type { BaseConverterContext, GenerateTypeUtils } from "./BaseConverter.js"; import type { IRNode } from "../types.js"; /** * Per-parent collector used by language emitters under `inlineTypes: true` to * accumulate nested type declarations destined for the parent's body block. * * Each invocation of `generateObjectType` allocates its own collector, * so grandchildren nest into the child's body — preserving the schema's * containment structure rather than flattening to the outermost parent. * * - `decls`: fully-formatted nested type declaration strings, in emission order. * - `bySignature`: within-parent dedup map (signature → already-assigned name). * Two properties of the same parent referencing the same shape share one * nested decl; two properties of *different* parents do not (each parent's * nested decls are scoped to its own namespace). */ export interface InlineNestedCollector { decls: string[]; bySignature: Map; } /** * Inline-mode replacement for `getReferencedType`. Returns the name to use in * place of an extracted top-level reference, side-effecting `collector` with a * fully-formatted nested type declaration when this signature is first seen. * * Language-specific decl assembly is delegated to `formatDecl` (e.g. Kotlin's * `[@Serializable\n]data class ${name}${body}` vs Swift's `${access} struct * ${name}: Codable ${body}`). The recursive emit step is delegated to * `recurseObjectType` — typically the language's `generateObjectType` * function. We pass it our parent's collector-aware utils as a defensive * default; the recursive call sees `c.inlineTypes === true` and will still * allocate its own collector internally for *its* nested types. * * Side effect to be aware of: `defaultResolveRefTypeName` reserves the chosen * name in `c.usedDeclarationNames`. That reservation is what prevents nested * names from colliding with top-level enum / discriminated-union names emitted * elsewhere in the same converter run, and it's why a shared `nameRegistry` * across emit calls flows through to nested-decl naming. */ export declare function generateInlineNestedDecl(c: C, ir: IRNode, collector: InlineNestedCollector, formatDecl: (c: C, name: string, body: string, ir: IRNode) => string, recurseObjectType: (c: C, ir: IRNode, utils: GenerateTypeUtils) => string): string | undefined; /** Indents each non-empty line of `text` by `n` spaces. */ export declare function indentLines(text: string, n: number): string;