/**
 * The type hierarchy — one derivation of "what is above this type, what is
 * below it, and what a call through it can land on".
 *
 * Three surfaces ask that question. The viewer draws it as a tree above the
 * members outline (design spec §3.10). `codegraph_explore` announces it as an
 * interface-dispatch boundary ("`execute` → runtime dispatch to **611** types
 * implementing `INodeType`"). `codegraph_node` shows the same relations as
 * chips. Three derivations would eventually disagree about the ONE number that
 * matters — how many implementations a call can reach — and a reader holding
 * two of them has no way to tell which is lying. So the walk lives here once,
 * and each caller renders it: `src/ui-server/api/node.ts` turns it into
 * `WireHierarchy`, `ToolHandler.buildPolymorphicBoundaries` into prose.
 *
 * Everything here is query-time and read-only. No edge is invented: the tree is
 * exactly the `extends`/`implements` edges the graph holds, and the one thing
 * that is *derived* — which members override an ancestor's — is derived by name
 * within a chain the graph already links, and is labelled as a match rather
 * than as an `overrides` edge (nothing in the engine emits one).
 *
 * ## Why the fan is the interesting direction
 *
 * Ancestors are a fact about the code you are reading: `class X extends Y` is
 * written on line 1. Descendants are a fact you cannot get from the file at
 * all — the implementations of an interface live anywhere in the repo, and they
 * are precisely what a call through that interface dispatches to. Go makes this
 * sharpest: `System` and `Fixed` satisfy `Clock` without either file naming the
 * other, and the `implements` edge that links them is synthesized by the
 * resolver (`synthesizedBy: 'go-implements'`). So the fan carries its own
 * provenance and the caller draws a synthesized hop differently — the same
 * honesty rule the Flow strip's dashed connectors follow.
 */
import type CodeGraph from '../index';
import type { Edge, EdgeKind, Node, NodeKind } from '../types';
/** The two edge kinds that make a type hierarchy. Nothing else is a subtype. */
export declare const HIERARCHY_EDGE_KINDS: readonly EdgeKind[];
/**
 * Kinds that can sit in a type hierarchy.
 *
 * `type_alias` is in deliberately — TypeScript's `interface A extends B` and
 * Rust's associated types both land here, and an alias with subtypes is a real
 * hierarchy however it was spelled. `enum` is in for Java/Kotlin/Swift, where an
 * enum implements interfaces.
 */
export declare const HIERARCHY_KINDS: ReadonlySet<NodeKind>;
/** Levels walked upward. A chain deeper than this is a generated-code artefact. */
export declare const MAX_ANCESTOR_DEPTH = 8;
/** Levels walked downward. Depth, not breadth — the fan itself is capped separately. */
export declare const MAX_DESCENDANT_DEPTH = 6;
/**
 * Subtypes returned across the whole downward walk.
 *
 * A framework base class can have thousands, and the caller caps again for
 * display; this bound is what stops the *query* from walking them. When it
 * bites, {@link TypeHierarchy.bounded} says so — a fan that quietly stopped at
 * 400 would read as a complete answer.
 */
export declare const MAX_DESCENDANTS = 400;
/**
 * Implementations at or above which a call through the type cannot be resolved
 * statically at all — the same threshold `codegraph_explore` uses before it
 * announces an interface-dispatch boundary.
 */
export declare const DISPATCH_MIN_IMPLEMENTERS = 8;
/** How a subtype is tied to the type above it. */
export type HierarchyRelation = 'extends' | 'implements';
/** One type in the tree, and the single edge that puts it there. */
export interface HierarchyEntry {
    node: Node;
    /** Steps from the focus. 1 = declared directly on the focus (either way). */
    depth: number;
    /**
     * The entry one step NEARER the focus — the row this one hangs off when the
     * tree is drawn. The focus's own id for a depth-1 entry.
     */
    parentId: string;
    relation: HierarchyRelation;
    /** The edge itself, always oriented subtype → supertype as the code declares it. */
    edge: Edge;
    /**
     * The edge was synthesized rather than parsed — Go's implicit interface
     * satisfaction, a framework registry. Drawn dashed, with its wiring site.
     */
    synthesized: boolean;
    /** Direct subtypes this entry has that are NOT in the returned set. */
    hiddenSubtypes: number;
}
/** A member of the focus that redeclares a member of one of its ancestors. */
export interface OverrideMatch {
    /** The member on the focus. */
    memberId: string;
    /** The member it redeclares. */
    baseId: string;
    /** The ancestor type that declares {@link baseId}. */
    baseTypeId: string;
    baseTypeName: string;
    /** How the focus reaches that ancestor — `implements` reads as "satisfies". */
    relation: HierarchyRelation;
}
/** What is above a type, what is below it, and what a call through it reaches. */
export interface TypeHierarchy {
    focus: Node;
    /** Supertypes, nearest first. Ordered so the focus's own parents lead. */
    ancestors: HierarchyEntry[];
    /** Subtypes, breadth-first, so depth 1 is complete before depth 2 begins. */
    descendants: HierarchyEntry[];
    /** True number of DIRECT subtypes, whatever `descendants` was capped to. */
    directSubtypes: number;
    /** Of {@link directSubtypes}, the ones tied by `implements`. */
    directImplementers: number;
    /**
     * The downward walk hit {@link MAX_DESCENDANTS} or {@link MAX_DESCENDANT_DEPTH}
     * — subtypes exist that are not in `descendants`.
     */
    bounded: boolean;
    /**
     * A call through this type dispatches at runtime rather than to one target.
     * `directImplementers >= DISPATCH_MIN_IMPLEMENTERS`.
     */
    polymorphic: boolean;
    /** Members of the focus that redeclare an ancestor's, keyed by member id. */
    overrides: Map<string, OverrideMatch>;
}
/**
 * Whether a node could have a hierarchy at all.
 *
 * Cheap enough to gate on before doing any work: a function never has one, and
 * the overwhelming majority of symbols a reader opens are functions.
 */
export declare function canHaveHierarchy(node: Node): boolean;
/**
 * The whole hierarchy of one type.
 *
 * Cost is one query per level in each direction plus one batched member read,
 * never one per node — a base class with 400 subtypes is 2–3 queries, not 400.
 *
 * Returns `null` when the node cannot have a hierarchy or has no
 * `extends`/`implements` edge in either direction, so a caller can gate on the
 * return value rather than on the emptiness of three lists.
 */
export declare function buildTypeHierarchy(cg: CodeGraph, focus: Node, options?: {
    overrides?: boolean;
}): TypeHierarchy | null;
/**
 * How many distinct types extend or implement this one — the number
 * `codegraph_explore` prints when it announces an interface dispatch and the
 * number the viewer's fan draws.
 *
 * DISTINCT types, not edges: a class tied to a supertype by both an `extends`
 * and a synthesized `implements` edge is one implementation, and a count that
 * disagrees with the length of the list beside it is the bug this function
 * exists to prevent.
 */
export declare function countImplementers(cg: CodeGraph, typeId: string): number;
//# sourceMappingURL=type-hierarchy.d.ts.map