/**
 * Content Diff Calculator
 *
 * Compares local content with remote CMS state to determine
 * what changes need to be made during push operations.
 */
import type { LocalContent, LocalFooterContent } from '../content/reader';
import type { PulledContent, ManagementFooterContent } from '../../client/management/types';
export type DiffType = 'create' | 'update' | 'unchanged';
export interface EntryDiff {
    type: DiffType | 'delete';
    identifier: string;
    contentType: string;
    /** List of changed field paths (for updates) */
    changes?: string[];
    /** Status change needed: publish or unpublish */
    statusChange?: 'publish' | 'unpublish';
}
export interface PageDiff {
    type: DiffType;
    identifier: string;
    /** List of changed field paths (for updates) */
    changes?: string[];
    /** Block diffs for this page */
    blocks?: BlockDiff[];
    /** Status change needed: publish or unpublish */
    statusChange?: 'publish' | 'unpublish';
}
export interface BlockDiff {
    type: DiffType | 'delete' | 'reorder';
    identifier: string;
    pageIdentifier: string;
    /** List of changed field paths (for updates) */
    changes?: string[];
}
export interface NavigationDiff {
    type: DiffType;
    name: string;
    /** List of changed field paths (for updates) */
    changes?: string[];
}
export interface SettingsDiff {
    type: 'update';
    /** List of changed field paths */
    changes: string[];
}
export interface FormDiff {
    type: DiffType;
    slug: string;
    /** List of changed field paths (for updates) */
    changes?: string[];
}
export interface FooterDiff {
    type: 'update' | 'unchanged';
    /** List of changed field paths (for updates) */
    changes?: string[];
}
export interface ContentDiff {
    /** Entry diffs grouped by content type */
    entries: Map<string, EntryDiff[]>;
    /** Page diffs */
    pages: PageDiff[];
    /** Navigation menu diffs */
    navigation: NavigationDiff[];
    /** Settings diff (null if no local settings file) */
    settings: SettingsDiff | null;
    /** Form diffs */
    forms: FormDiff[];
    /** Footer diff (null if no local footer file) */
    footer: FooterDiff | null;
    /** Summary statistics */
    summary: {
        entries: {
            create: number;
            update: number;
            delete: number;
            unchanged: number;
            publish: number;
            unpublish: number;
        };
        pages: {
            create: number;
            update: number;
            unchanged: number;
            publish: number;
            unpublish: number;
        };
        blocks: {
            create: number;
            update: number;
            delete: number;
            unchanged: number;
        };
        navigation: {
            create: number;
            update: number;
            unchanged: number;
        };
        settings: {
            update: number;
            unchanged: number;
        };
        forms: {
            create: number;
            update: number;
            unchanged: number;
        };
        footer: {
            update: number;
            unchanged: number;
        };
    };
    /** Warnings about content that couldn't be processed */
    warnings?: {
        /** Number of remote entries without identifiers (can't be deleted via CLI) */
        entriesWithoutIdentifier?: number;
    };
}
export interface DiffOptions {
    /** How to handle existing entries: 'skip' ignores updates, 'update' includes them */
    existingEntries: 'skip' | 'update';
    /** Whether to include delete diffs for remote entries not in local (default: false) */
    deleteMissing?: boolean;
}
export type JsonDiffMode = 'summary' | 'full';
export type JsonDiffOperation = 'create' | 'update' | 'delete';
export type JsonDiffChangeType = 'entry' | 'page' | 'block' | 'navigation' | 'settings' | 'form';
export interface JsonDiffChange {
    type: JsonDiffChangeType;
    identifier: string;
    operation: JsonDiffOperation;
    before?: unknown;
    after?: unknown;
    diff?: unknown;
    /** Status change: publish or unpublish */
    statusChange?: 'publish' | 'unpublish';
}
export interface JsonDiff {
    summary: {
        creates: number;
        updates: number;
        deletes: number;
        publishes: number;
        unpublishes: number;
    };
    changes: JsonDiffChange[];
}
/** JSON diff output for pull --dry-run --json-diff */
export interface PullJsonDiff {
    mode: JsonDiffMode;
    direction: 'pull';
    summary: ContentDiff['summary'];
    changes?: PullJsonDiffChange[];
}
export interface PullJsonDiffChange {
    type: 'entry' | 'page' | 'navigation' | 'settings';
    operation: 'create' | 'update';
    identifier: string;
    contentType?: string;
    before?: unknown;
    after?: unknown;
}
export declare function buildJsonDiff(diff: ContentDiff, local: LocalContent, remote: PulledContent, mode: JsonDiffMode): JsonDiff;
export declare function calculateFooterDiff(localFooter: LocalFooterContent | null, remoteFooter: ManagementFooterContent | null): {
    diff: FooterDiff | null;
    summary: ContentDiff['summary']['footer'];
};
/**
 * Calculate differences between local content and remote CMS state.
 *
 * @param local - Local content from JSON files
 * @param remote - Remote content pulled from CMS
 * @param options - Diff options
 * @returns Content diff with all changes categorized
 */
export declare function calculateDiff(local: LocalContent, remote: PulledContent, options: DiffOptions): ContentDiff;
/**
 * Check if there are any pending changes in the diff.
 */
export declare function hasPendingChanges(diff: ContentDiff): boolean;
/**
 * Format diff summary for display.
 */
export declare function formatDiffSummary(diff: ContentDiff): string;
/**
 * Format detailed diff for display.
 */
export declare function formatDiffDetail(diff: ContentDiff): string;
/**
 * Calculate differences for pull operation (remote → local).
 * This is the inverse of calculateDiff - it shows what would change locally
 * if we pulled content from remote.
 *
 * @param remote - Remote content from CMS (source)
 * @param local - Local content from files (target, may be null if no local content)
 * @returns Content diff showing what would be created/updated locally
 */
export declare function calculatePullDiff(remote: PulledContent, local: LocalContent | null): ContentDiff;
export interface FieldChange {
    path: string;
    before: unknown;
    after: unknown;
}
/**
 * Find changed fields between two objects with their before/after values.
 */
export declare function findChangedFieldsWithValues(local: Record<string, unknown>, remote: Record<string, unknown>, prefix?: string): FieldChange[];
/**
 * Format a value for human-readable display.
 */
export declare function formatValue(value: unknown): string;
/**
 * Format a ContentDiff with field-level before/after values for human display.
 * Used by push --dry-run --diff.
 */
export declare function formatHumanDiff(diff: ContentDiff, local: LocalContent, remote: PulledContent): string;
