/**
 * Conflict Resolver for Living Docs Synchronization
 *
 * CRITICAL PRINCIPLE: External tool status ALWAYS wins in conflicts!
 * This ensures that QA and stakeholder decisions in external tools
 * take precedence over local development status.
 */
export interface ConflictResolution {
    field: string;
    localValue: any;
    externalValue: any;
    resolution: 'external' | 'local';
    resolvedValue: any;
    reason: string;
    timestamp: string;
}
/**
 * Timestamp comparison result for pull sync (Increment 0089)
 */
export interface TimestampComparisonResult {
    winner: 'local' | 'external' | 'none';
    localTimestamp: string | null;
    externalTimestamp: string;
    timeDiffMs: number;
    reason: string;
}
export interface SpecMetadata {
    id: string;
    title: string;
    status: SpecStatus;
    priority?: Priority;
    externalLinks?: {
        ado?: {
            featureId: number;
            featureUrl: string;
            syncedAt?: string;
            lastExternalStatus?: string;
        };
        jira?: {
            issueKey: string;
            issueUrl: string;
            syncedAt?: string;
            lastExternalStatus?: string;
        };
        github?: {
            issue: number;
            url: string;
            syncedAt?: string;
            lastExternalStatus?: string;
        };
    };
}
export type SpecStatus = 'draft' | 'in-progress' | 'implemented' | 'in-qa' | 'complete' | 'blocked' | 'cancelled';
export type Priority = 'P0' | 'P1' | 'P2' | 'P3';
export interface ExternalStatus {
    tool: 'ado' | 'jira' | 'github';
    status: string;
    mappedStatus: SpecStatus;
    priority?: string;
    lastModified: string;
}
export declare class ConflictResolver {
    private resolutionLog;
    /**
     * Map external status to local SpecWeave status
     */
    mapExternalStatus(tool: 'ado' | 'jira' | 'github', externalStatus: string): SpecStatus;
    /**
     * Map local status to external tool status
     */
    mapLocalStatus(tool: 'ado' | 'jira' | 'github', localStatus: SpecStatus): string;
    /**
     * CRITICAL: Resolve status conflict - EXTERNAL ALWAYS WINS
     */
    resolveStatusConflict(localStatus: SpecStatus, externalStatus: ExternalStatus): ConflictResolution;
    /**
     * Compare timestamps to determine winner (Increment 0089)
     *
     * For pull sync, we compare local lastModified vs external ChangedDate.
     * The more recent timestamp wins.
     *
     * @param localTimestamp - Local file lastModified timestamp (ISO string or null)
     * @param externalTimestamp - External tool ChangedDate (ISO string)
     * @returns Comparison result with winner and reasoning
     */
    compareTimestamps(localTimestamp: string | null, externalTimestamp: string): TimestampComparisonResult;
    /**
     * Resolve conflict using timestamp comparison (Increment 0089)
     *
     * Combines timestamp comparison with status conflict resolution.
     * Used by ExternalChangePuller for pull sync.
     *
     * @param field - The field being compared (e.g., 'status')
     * @param localValue - Current local value
     * @param externalValue - Value from external tool
     * @param localTimestamp - Local lastModified timestamp
     * @param externalTimestamp - External ChangedDate
     * @returns Conflict resolution result
     */
    resolveWithTimestamp(field: string, localValue: any, externalValue: any, localTimestamp: string | null, externalTimestamp: string): ConflictResolution;
    /**
     * Resolve priority conflict - EXTERNAL WINS
     */
    resolvePriorityConflict(localPriority: Priority | undefined, externalPriority: string | undefined): ConflictResolution;
    /**
     * Apply conflict resolutions to spec
     */
    applyResolutions(specPath: string, resolutions: ConflictResolution[]): Promise<void>;
    /**
     * Validate that external status wins in implementation
     */
    validateImplementation(implementationCode: string): {
        valid: boolean;
        violations: string[];
    };
    /**
     * Get resolution history
     */
    getResolutionLog(): ConflictResolution[];
    /**
     * Generate resolution report
     */
    generateReport(): string;
}
/**
 * Load spec metadata from file
 */
export declare function loadSpecMetadata(specPath: string): Promise<SpecMetadata>;
/**
 * Perform three-permission sync with conflict resolution
 */
export declare function performBidirectionalSync(specPath: string, externalStatus: ExternalStatus): Promise<void>;
export default ConflictResolver;
//# sourceMappingURL=conflict-resolver.d.ts.map