/**
 * BackupService - Universal pre-save and pre-delete backups for all element types
 *
 * Provides automatic backup creation before destructive operations (edit/delete)
 * with bounded retention (max N backups per element per date folder).
 *
 * Design principles:
 * - Non-fatal: backup failures never block the primary operation
 * - Bounded: pruning prevents unbounded disk growth
 * - Configurable: enabled/disabled via env var, max backups configurable
 *
 * Backup directory structure:
 *   {backupRootDir}/{elementType}/YYYY-MM-DD/{name}.backup-{ISO-timestamp}.{ext}
 *
 * @module BackupService
 */
import type { IFileOperationsService } from './FileOperationsService.js';
export interface BackupConfig {
    /** Root directory for all backups (e.g., ~/.dollhouse/portfolio/.backups) */
    backupRootDir: string;
    /** Maximum backup files to keep per element per date folder */
    maxBackupsPerElement: number;
    /** Whether backups are enabled */
    enabled: boolean;
}
export interface BackupResult {
    /** Whether a backup was successfully created (by rename or copy) */
    success: boolean;
    /** Path to the backup file, if created */
    backupPath?: string;
    /** Whether the original file was moved (renamed) to the backup location.
     *  When true, the caller should skip deleting the original file. */
    movedOriginal?: boolean;
    error?: string;
}
export declare class BackupService {
    private readonly fileOperations;
    private readonly config;
    constructor(fileOperations: IFileOperationsService, config: BackupConfig);
    /**
     * Create a backup copy of a file before it is overwritten (save/edit).
     * No-op if backups are disabled or the file doesn't exist yet (new element).
     * Non-fatal: catches all errors and returns a result instead of throwing.
     */
    backupBeforeSave(absolutePath: string, elementType: string): Promise<BackupResult>;
    /**
     * Create a backup of a file before it is deleted.
     * Moves the file to the backup directory (rename) so the caller can skip deleteFile().
     * Falls back to copy if rename fails (cross-device).
     * Non-fatal: catches all errors and returns a result instead of throwing.
     */
    backupBeforeDelete(absolutePath: string, elementType: string): Promise<BackupResult>;
    /**
     * Prune old backups for a given element, keeping only maxBackupsPerElement newest.
     */
    pruneBackups(backupDir: string, originalBasename: string): Promise<void>;
    /**
     * Build the date-partitioned backup directory path.
     * e.g., {backupRootDir}/personas/2026-03-04/
     */
    private getDateBackupDir;
    /**
     * Generate a backup filename from the original basename.
     * e.g., "creative-writer.md" → "creative-writer.backup-2026-03-04T14-30-00-000Z.md"
     */
    private generateBackupFilename;
    private stripExtension;
    /**
     * Internal helper used by backupBeforeSave — copies file to backup dir then prunes.
     */
    private createBackup;
}
//# sourceMappingURL=BackupService.d.ts.map