// Copyright (c) 2026 Codemongous LLC. All Rights Reserved.
#pragma once

#include "SourcifyCoreDefines.h"
#include <string>
#include <vector>

namespace Sourcify
{
    /**
     * Result of a backup or restore operation for public API
     */
    struct BackupResult
    {
        bool Success = false;
        std::wstring ErrorMessage;
        std::vector<std::wstring> AffectedFiles;
    };

    /**
     * Public interface for FileBackupManager, exposed through ISourcifyCore
     * Allows external code to interact with the backup/restore system
     */
    class SOURCIFY_CORE_DLL IFileBackupManager
    {
    public:
        virtual ~IFileBackupManager() = default;

        /**
         * Restore all backed-up files to their original state
         * This is the main rollback operation for Undo functionality
         */
        [[nodiscard]] virtual BackupResult RestoreAllBackups() = 0;

        /**
         * Commit the transaction and optionally clean up backup files
         * @param DeleteBackups If true, removes backup files after successful commit
         */
        [[nodiscard]] virtual BackupResult CommitAndCleanup(bool DeleteBackups = true) = 0;

        /**
         * Check if a backup session is currently active
         */
        [[nodiscard]] virtual bool IsSessionActive() const = 0;

        /**
         * Get list of files that were modified since backup
         */
        [[nodiscard]] virtual std::vector<std::wstring> GetModifiedFiles() const = 0;

        /**
         * Get current backup session directory
         */
        [[nodiscard]] virtual std::wstring GetBackupSessionDirectory() const = 0;
    };
}
