/**
 * Media Sync Helper
 *
 * Handles syncing media assets between environments during pull/push operations.
 *
 * With relative paths, storagePath values in content are like "originals/2024/12/abc.jpg"
 * (without site prefix). The actual files are stored at "sites/{siteId}/originals/...".
 *
 * When syncing:
 * 1. Extract all relative storagePath values from content
 * 2. Download files from source: sites/{sourceSiteId}/{relativePath}
 * 3. Upload files to target: sites/{targetSiteId}/{relativePath}
 *
 * No path rewriting in content data is needed since paths are relative!
 */
/**
 * Extract all unique storagePath values from content data.
 * Recursively walks through objects and arrays to find all media references.
 */
export declare function extractMediaPaths(data: unknown): Set<string>;
/**
 * Extract all unique media identifiers from content data.
 * Recursively walks through objects and arrays to find media references.
 */
export declare function extractMediaIdentifiers(data: unknown): Set<string>;
/**
 * Build a public URL for a storage path.
 * @param supabaseUrl - The Supabase project URL
 * @param storagePath - Relative or site-scoped path within the bucket
 * @param siteId - The site ID context for relative paths
 * @param bucket - Storage bucket name (default: "media")
 */
export declare function buildStorageUrl(supabaseUrl: string, storagePath: string, siteId: string, bucket?: string): string;
/**
 * Check if a file path is an image that can be transformed by Supabase.
 * @param path - The file path or storage path
 */
export declare function isTransformableImage(path: string): boolean;
/**
 * Build a URL using Supabase's image transform endpoint.
 * Returns a resized version to avoid exceeding upload size limits.
 *
 * @param supabaseUrl - The Supabase project URL
 * @param storagePath - Relative or site-scoped path within the bucket
 * @param siteId - The site ID context for relative paths
 * @param options - Transform options (width, quality)
 */
export declare function buildImageTransformUrl(supabaseUrl: string, storagePath: string, siteId: string, options?: {
    width?: number;
    quality?: number;
}): string;
/**
 * Download a file from a public Supabase storage URL.
 * Returns the file data as a Buffer, or null if download fails after retries.
 *
 * Uses exponential backoff retry for transient network failures.
 */
export declare function downloadMedia(url: string, options?: {
    maxRetries?: number;
}): Promise<{
    data: Buffer;
    contentType: string;
} | null>;
/**
 * Result of syncing a single media file
 */
export interface MediaSyncResult {
    /** Relative storage path */
    relativePath: string;
    /** Whether the sync was successful */
    success: boolean;
    /** Error message if sync failed */
    error?: string;
    /** Whether the file was skipped (already exists) */
    skipped?: boolean;
}
/**
 * Result of syncing all media
 */
export interface MediaSyncSummary {
    /** Total number of unique media files found */
    total: number;
    /** Number successfully synced */
    synced: number;
    /** Number skipped (already exist) */
    skipped: number;
    /** Number that failed */
    failed: number;
    /** Individual results */
    results: MediaSyncResult[];
}
/**
 * Options for media sync
 */
export interface MediaSyncOptions {
    /** Supabase URL of the source environment */
    sourceSupabaseUrl: string;
    /** Site ID of the source environment */
    sourceSiteId: string;
    /** Site ID of the target environment */
    targetSiteId: string;
    /** Storage bucket name */
    bucket?: string;
    /** Callback for progress updates */
    onProgress?: (completed: number, total: number, current: string) => void;
}
/**
 * Interface for media upload client (to be implemented by management client)
 */
export interface MediaUploadClient {
    /**
     * Upload a media file to the target environment.
     * Returns the storage path if successful, or error if failed.
     */
    uploadMedia(file: {
        data: Buffer;
        filename: string;
        contentType: string;
        storagePath: string;
    }): Promise<{
        storagePath: string;
    } | {
        error: string;
    }>;
    /**
     * Check if a media file already exists at the given relative path.
     */
    mediaExists(storagePath: string): Promise<boolean>;
}
/**
 * Sync media files from source to target environment.
 *
 * With relative paths, content data doesn't need to be modified.
 * We just copy files from source site folder to target site folder.
 *
 * @param content - The content data containing media references
 * @param client - Client for uploading to target environment
 * @param options - Sync options
 * @returns Summary of sync results (content unchanged since paths are relative)
 */
export declare function syncMedia<T>(content: T, client: MediaUploadClient, options: MediaSyncOptions): Promise<{
    summary: MediaSyncSummary;
    content: T;
}>;
