import { ConflictResolution } from "../validation/dolt-schemas.js";
import { AgentsManageDatabaseClient } from "../db/manage/manage-client.js";
import { FkDeps } from "./fk-map.js";

//#region src/dolt/resolve-conflicts.d.ts
declare class ResolutionValidationError extends Error {
  constructor(message: string);
}
type OperationType = 'skip' | 'delete' | 'update' | 'insert';
interface ClassifiedResolution {
  resolution: ConflictResolution;
  conflictRow: Record<string, unknown>;
  pkColumns: string[];
  operation: OperationType;
}
declare function computeTableInsertOrder(fkDeps: FkDeps): Map<string, number>;
declare function sortByFkDependencyOrder(classified: ClassifiedResolution[]): ClassifiedResolution[];
declare const applyResolutions: (db: AgentsManageDatabaseClient) => (resolutions: ConflictResolution[]) => Promise<void>;
//#endregion
export { ResolutionValidationError, applyResolutions, computeTableInsertOrder, sortByFkDependencyOrder };