import type * as tae from 'typescript-api-extractor';
import { type FormattedParameter, type FormattedProperty, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
import type { ExternalTypesCollector } from "./externalTypes.mjs";
import type { HastRoot } from "../../CodeHighlighter/types.mjs";
/**
 * Formatted function metadata with plain text types and parsed markdown descriptions.
 *
 * Type highlighting (type → HAST, shortType, detailedType) is deferred to
 * the loadServerTypes stage via highlightTypesMeta() after highlightTypes().
 */
export type FunctionTypeMeta = {
  name: string;
  description?: HastRoot;
  /** Plain text version of description for markdown generation */
  descriptionText?: string;
  /** Ordered function parameters */
  parameters?: FormattedParameter[];
  /**
   * Expanded properties from a single anonymous object parameter.
   * When populated, `parameters` should be omitted and headings should
   * say "Properties" instead of "Parameters".
   */
  expandedProperties?: Record<string, FormattedProperty>;
  /** Return value - either plain text string or object with properties (like hook return values) */
  returnValue: Record<string, FormattedProperty> | string;
  /** Plain text version of returnValue for markdown generation (when returnValue is string) */
  returnValueText?: string;
  /** Description of the return value (parsed markdown as HAST) */
  returnValueDescription?: HastRoot;
  /** Plain text version of returnValueDescription for markdown generation */
  returnValueDescriptionText?: string;
};
export interface FormatFunctionOptions {
  /** Pattern/replacement pairs to apply to descriptions */
  descriptionReplacements?: DescriptionReplacement[];
  /** Options for inline type formatting (e.g., unionPrintWidth) */
  formatting?: FormatInlineTypeOptions;
  /** Collector for external types discovered during formatting */
  externalTypes?: ExternalTypesCollector;
}
/**
 * Formats function export data into a structured metadata object.
 *
 * @param func - The function export node from typescript-api-extractor
 * @param typeNameMap - Map for transforming type names
 * @param rewriteContext - Context for type string rewriting including type compatibility map
 * @param options - Formatting options
 * @returns Formatted function metadata with parameters and return value
 */
export declare function formatFunctionData(func: tae.ExportNode & {
  type: tae.FunctionNode;
}, typeNameMap: Record<string, string>, rewriteContext: TypeRewriteContext, options?: FormatFunctionOptions): Promise<FunctionTypeMeta>;
/**
 * Type guard to check if an export node is a public function (not a hook).
 *
 * @param exportNode - The export node to check
 * @returns true if the export is a public function that should be documented
 */
export declare function isPublicFunction(exportNode: tae.ExportNode): exportNode is tae.ExportNode & {
  type: tae.FunctionNode;
};