/**
 * Merge Strategy - Conflict resolution for sync operations
 *
 * Implements Last-Write-Wins (LWW) strategy with special handling for:
 * - Tombstones (soft deletes)
 * - Status fields (closed wins over open)
 * - Tags (set union merge)
 * - Dependencies (removal is authoritative)
 */
import type { Element, Dependency } from '@stoneforge/core';
import { MergeResolution, TombstoneStatus, type ConflictRecord, type DependencyConflictRecord } from './types.js';
/**
 * Merge result for elements
 */
export interface ElementMergeResult {
    /** The winning element */
    element: Element;
    /** How the merge was resolved */
    resolution: MergeResolution;
    /** Whether local element was modified */
    localModified: boolean;
    /** Conflict record if there was a conflict */
    conflict?: ConflictRecord;
}
/**
 * Merge two versions of an element using Last-Write-Wins strategy
 *
 * Special cases:
 * - Identical content hash: Skip (no conflict)
 * - Tombstone handling: Fresh tombstone wins over live
 * - Status merge: Closed wins over open states
 * - Tags merge: Union of both tag sets
 *
 * @param local - Local element
 * @param remote - Remote element (from import)
 * @param tombstoneTtl - Tombstone TTL in milliseconds (default: 30 days)
 * @returns Merge result
 */
export declare function mergeElements(local: Element, remote: Element, tombstoneTtl?: number): ElementMergeResult;
/**
 * Get tombstone status for an element
 */
export declare function getTombstoneStatus(element: Element, ttlMs: number): TombstoneStatus;
/**
 * Merge two tag arrays using set union
 * Never loses a tag in merge
 *
 * @param localTags - Local tags
 * @param remoteTags - Remote tags
 * @returns Merged tags (sorted for determinism)
 */
export declare function mergeTags(localTags: string[], remoteTags: string[]): string[];
/**
 * Dependency merge result
 */
export interface DependencyMergeResult {
    /** Dependencies to keep */
    keep: Dependency[];
    /** Dependencies that were added */
    added: Dependency[];
    /** Dependencies that were removed */
    removed: Dependency[];
    /** Conflict records */
    conflicts: DependencyConflictRecord[];
}
/**
 * Merge dependencies between local and remote
 *
 * Rules:
 * - Removal is authoritative (if one side removed, it's removed)
 * - Additions from both sides kept
 * - No duplicate dependencies
 *
 * @param localDeps - Local dependencies
 * @param remoteDeps - Remote dependencies
 * @param originalDeps - Original dependencies (baseline for detecting removals)
 * @returns Merge result
 */
export declare function mergeDependencies(localDeps: Dependency[], remoteDeps: Dependency[], originalDeps?: Dependency[]): DependencyMergeResult;
//# sourceMappingURL=merge.d.ts.map