/**
 * @fileoverview Pure helpers for the Database Designer dashboard's AI-agent integration.
 *
 * These functions are intentionally free of Angular / component dependencies so they
 * can be unit-tested in isolation. The component
 * ({@link DatabaseDesignerDashboardComponent}) supplies a plain snapshot of its current
 * schema-browsing state and these helpers shape it into the key-value `AgentContext`
 * object that flows to the async chat agent and the realtime co-agent via
 * `NavigationService.SetAgentContext`.
 *
 * The deep ("hardcore", Data-Explorer depth) enrichment here mirrors the Entity Admin /
 * Data Explorer pattern: bounded name lists (cap {@link DATABASE_DESIGNER_NAME_LIST_CAP}
 * with a companion `*Count` flag when truncated), schema groupings, the selected entity's
 * field/relationship summary, and a tolerant id→name→display-name→contains resolver so the
 * agent can refer to entities the way the user reads them on screen — the DISPLAY name
 * (e.g. "AI Models", not the registered "MJ: AI Models").
 *
 * 🔒 SAFETY BOUNDARY: The Database Designer surface CAN mutate the database schema
 * (create entities, alter tables, add/remove fields, run the DDL pipeline). The context
 * shaped here describes ONLY what the user is BROWSING — the accessible-entity list, the
 * current search/selection, schema groupings, and whether the modify panel is open. No
 * helper in this file describes — and no tool may perform — any schema mutation. The agent
 * browses the schema; the user makes changes from the wizard / modify panel.
 */
/**
 * The "MJ: " schema prefix carried by newer core entities (e.g. "MJ: AI Models",
 * "MJ: ML Models"). The designer strips it when an entity has no explicit DisplayName, and
 * users almost always say the stripped form ("AI Models") rather than the full registered
 * Name. See {@link entityDisplayName} / {@link stripMJPrefix}.
 */
export declare const MJ_ENTITY_NAME_PREFIX = "MJ: ";
/**
 * Upper bound on how many names a context field publishes (AvailableEntities,
 * RelatedEntities, SchemaGroups). Keeping the streamed note bounded avoids flooding the
 * co-agent with hundreds of names; when the underlying list is larger we surface a
 * companion total-count field instead.
 */
export declare const DATABASE_DESIGNER_NAME_LIST_CAP = 25;
/**
 * Strip the leading "MJ: " schema prefix from an entity Name, if present.
 * Pure + deterministic. Returns the input unchanged when the prefix is absent.
 */
export declare function stripMJPrefix(name: string): string;
/**
 * The display label the designer shows for an entity — the entity's DisplayName when set,
 * else the registered Name with the "MJ: " schema prefix stripped. This is what the user
 * reads on screen and therefore what they say ("AI Models", not "MJ: AI Models").
 */
export declare function entityDisplayName(name: string, displayName?: string | null): string;
/**
 * A minimal name-bearing entity descriptor, supplied by the component so the pure
 * resolver can match agent input against what the user sees. Mirrors the salient slice of
 * an `AccessibleEntity` row (the designer's list model), optionally enriched with the
 * entity's `DisplayName` from `EntityInfo` metadata.
 */
export interface EntityNameCandidate {
    /** The `MJ: Entities` id (designer's `entityId`). */
    ID: string;
    /** The registered entity Name (designer's `entityName`, may carry an "MJ: " prefix). */
    Name: string;
    /** The entity's DisplayName, if any (takes precedence over the prefix-stripped Name). */
    DisplayName?: string | null;
}
/**
 * Resolve an agent-supplied entity reference to one of the accessible entities. The agent
 * may pass either an entity ID (GUID) or a name the way the user sees it. We try, in order:
 *   1. exact ID (case-insensitive — UUIDs may differ in case across SQL Server / PG)
 *   2. exact registered Name (case-insensitive)
 *   3. display name (case-insensitive) — DisplayName, else the prefix-stripped Name
 *   4. display name ignoring the "MJ: " prefix (covers an input carrying the prefix)
 *   5. partial (contains) match on the display name
 *
 * Pure + deterministic over the supplied candidate list, so it's unit-testable in
 * isolation; the component passes its accessible-entity rows (structurally
 * `EntityNameCandidate[]`).
 *
 * @param input - whatever the agent passed (an entity ID or the on-screen display name)
 * @param candidates - the entities available in the designer
 * @returns the matched candidate, or null on a miss
 */
export declare function resolveEntityByIdOrName<T extends EntityNameCandidate>(input: string, candidates: readonly T[]): T | null;
/**
 * Build a tolerant "not found" error for an ID-or-name lookup miss, listing a bounded
 * sample of available entity DISPLAY names so the agent can correct itself.
 */
export declare function buildEntityNotFoundError(input: string, candidates: readonly EntityNameCandidate[]): string;
/**
 * A summary of one field on the selected entity — the field name + its SQL/semantic type +
 * nullability. The component derives these from the loaded entity detail's columns.
 */
export interface FieldSummary {
    Name: string;
    Type: string;
    IsNullable: boolean;
}
/**
 * A summary of one related entity for the selected entity — the related entity's display
 * name and the relationship type (e.g. "One To Many"). The component derives these from
 * `EntityInfo.RelatedEntities` for the selected entity.
 */
export interface RelatedEntitySummary {
    Name: string;
    RelationshipType: string;
}
/**
 * A summary of one schema grouping in the designer — the schema name and how many
 * accessible entities fall under it. Lets the co-agent see the schema landscape.
 */
export interface SchemaGroupSummary {
    SchemaName: string;
    EntityCount: number;
}
/**
 * The plain, component-supplied snapshot used to build the agent context.
 * Mirrors the salient slice of the Database Designer dashboard's browse state.
 */
export interface DatabaseDesignerAgentContextInput {
    /** Total number of entities the current user can access in the designer. */
    EntityCount: number;
    /** Entity count after the current search/schema filter is applied. */
    FilteredEntityCount: number;
    /** Current free-text search term applied to the entity list (empty when none). */
    SearchText: string;
    /** Active schema filter applied to the entity list (empty when none). */
    SchemaFilter: string;
    /** ID of the entity whose detail panel is open, or null. */
    SelectedEntityId: string | null;
    /** Registered Name of the entity whose detail panel is open, or null. */
    SelectedEntityName: string | null;
    /** Display name of the selected entity (DisplayName, else prefix-stripped Name), or null. */
    SelectedEntityDisplayName: string | null;
    /** Schema of the selected entity, or null. */
    SelectedEntitySchema: string | null;
    /** Physical table name of the selected entity, or null. */
    SelectedEntityTable: string | null;
    /** User-defined field count of the selected entity, or null when not (yet) loaded. */
    SelectedEntityFieldCount: number | null;
    /**
     * Field summaries for the selected entity (name · type · nullability). Empty when
     * nothing is selected or detail hasn't loaded. The component supplies the full list;
     * this helper bounds it — see {@link DATABASE_DESIGNER_NAME_LIST_CAP}.
     */
    SelectedEntityFields: FieldSummary[];
    /**
     * Related-entity summaries for the selected entity (from EntityInfo.RelatedEntities).
     * Empty when nothing is selected. The component supplies the full list; this helper
     * bounds it — see {@link DATABASE_DESIGNER_NAME_LIST_CAP}.
     */
    RelatedEntities: RelatedEntitySummary[];
    /** Whether the entity detail (modify) panel is currently open. */
    ShowModifyPanel: boolean;
    /** Whether the accessible-entity list is currently loading. */
    IsLoading: boolean;
    /**
     * DISPLAY names of the entities currently visible in the designer (after the filter),
     * so the agent knows what's selectable via the SelectEntity / NavigateToEntityRecord
     * tools. The component supplies the full filtered list; this helper bounds it.
     */
    AvailableEntityNames: string[];
    /**
     * Schema-grouping summaries across the accessible entities. The component supplies the
     * full list; this helper bounds it — see {@link DATABASE_DESIGNER_NAME_LIST_CAP}.
     */
    SchemaGroups: SchemaGroupSummary[];
}
/**
 * Build the agent-visible context object for the Database Designer schema browser.
 *
 * Reports how the designer is currently scoped (total vs. filtered entity counts, whether a
 * filter is narrowing the set + the active filter values), what (if anything) is selected
 * (id + registered name + display name + schema + table + field count + a bounded field and
 * relationship summary), whether the detail panel is open, whether data is still loading,
 * the bounded available-entity DISPLAY-name list, and the schema-grouping landscape.
 * `HasSearch` / `HasActiveFilters` are derived so the agent can tell the user is looking at
 * a filtered subset without re-deriving it.
 *
 * Keeping this a pure function (no `this`) makes the context shape unit-testable and
 * decouples it from change-detection timing.
 *
 * @param input - the component's current browse-state snapshot
 * @returns a flat key-value object suitable for `SetAgentContext`
 */
export declare function buildDatabaseDesignerAgentContext(input: DatabaseDesignerAgentContextInput): Record<string, unknown>;
//# sourceMappingURL=database-designer-agent-context.d.ts.map