/**
 * Plural entity-type repair service — detects and resolves plural entity_type
 * names in the schema registry and entities table.
 *
 * Two repair modes for plural types:
 *
 *   1. Singular sibling exists: merge entities from the plural type into the
 *      singular type using the existing merge infrastructure, then mark the
 *      plural schema inactive.
 *
 *   2. No singular sibling: register a new schema for the singular name with
 *      the plural name recorded in aliases, leaving existing data in place
 *      (no entity moves required — the plural schema stays active until
 *      explicitly migrated by the operator).
 *
 * Dry-run by default. Pass dryRun: false to write changes.
 *
 * See entity_type_guard.ts for the naming rules (suggestSingular, etc.).
 */
export interface PluralTypeAuditEntry {
    plural_type: string;
    suggested_singular: string;
    /** "merge" when a singular sibling exists; "alias" when it must be created */
    strategy: "merge" | "alias";
    /** Entity IDs of plural-type entities, grouped by user_id. */
    entity_groups: Array<{
        user_id: string;
        entity_ids: string[];
    }>;
    /** Entity IDs of singular-type entities (merge target), grouped by user_id. */
    singular_entity_groups: Array<{
        user_id: string;
        entity_ids: string[];
    }>;
}
export interface PluralTypeRepairResult {
    plural_type: string;
    strategy: "merge" | "alias";
    /** Number of entities merged into the singular type (merge strategy). */
    entities_merged: number;
    /** New schema registered (alias strategy). */
    alias_schema_registered: boolean;
    errors: string[];
}
export interface PluralTypeRepairRunResult {
    plural_types_found: number;
    plural_types_repaired: number;
    total_entities_merged: number;
    alias_schemas_registered: number;
    entries: PluralTypeRepairResult[];
    errors: string[];
}
/** Identify all plural entity types currently in the schema registry. */
export declare function auditPluralTypes(): Promise<PluralTypeAuditEntry[]>;
/**
 * Repair a single plural type entry (dry-run safe).
 *
 * merge strategy: for each entity in the plural type, attempts to find a
 * canonical merge target in the singular type (first entity of the same user).
 * If no entity exists in the singular type for that user, a new entity is NOT
 * created — the plural entity is left in place and reported as a skipped merge.
 *
 * alias strategy: registers a new schema for the singular name with the plural
 * name in aliases. The plural schema remains active; no entity data is moved.
 */
export declare function repairPluralType(entry: PluralTypeAuditEntry, dryRun: boolean): Promise<PluralTypeRepairResult>;
/**
 * Audit and (optionally) repair all plural entity types.
 * @param dryRun When true, report changes but write nothing. Default: true.
 */
export declare function repairAllPluralTypes(dryRun?: boolean): Promise<PluralTypeRepairRunResult>;
//# sourceMappingURL=plural_type_repair.d.ts.map