/**
 * Schema-driven reference linking.
 *
 * When a schema declares `reference_fields`, this service auto-creates typed
 * relationships between the stored entity and the entity referenced by the
 * named field value.
 *
 * The referenced entity is resolved by (1) treating the field value as a
 * canonical name / identifier and (2) looking up an existing entity of the
 * declared `target_entity_type`. If no match is found, the link is skipped
 * (we do not invent targets).
 *
 * This is the schema-agnostic replacement for hardcoded
 * "if entity.category === 'foo', link to Foo" logic.
 */
import type { SchemaDefinition } from "./schema_registry.js";
export interface AutoLinkReferenceFieldsParams {
    entityId: string;
    entityType: string;
    fields: Record<string, unknown>;
    schema: SchemaDefinition | null | undefined;
    userId: string;
    sourceId?: string;
}
export interface AutoLinkResult {
    created: number;
    skipped: number;
    details: Array<{
        field: string;
        target_entity_type: string;
        target_canonical_name: string;
        target_entity_id: string | null;
        relationship_type: string;
        linked: boolean;
    }>;
}
export declare function autoLinkReferenceFields(params: AutoLinkReferenceFieldsParams): Promise<AutoLinkResult>;
//# sourceMappingURL=schema_reference_linking.d.ts.map