#ifndef ASYNC_WORLD_CLONER_HPP_
#define ASYNC_WORLD_CLONER_HPP_

#include <AtomicDataStore/AtomicDataStore.hpp>
#include <WorldAvatar/WorldAvatar.hpp>
#include <string>

/**
 * @brief Handles cloning a world asynchronously.
 */
class AsyncWorldCloner final
{
private:
    AtomicDataStore oldStore;
    AtomicDataStore newStore;
    std::string error;
    std::atomic<float> progress;
    std::atomic<bool> done;
    AtomicDataStore::Plan plan;

public:
    AsyncWorldCloner(const std::string &oldPath, const std::string &newPath);

    void start(bool enableCheats, std::optional<WorldAvatar> avatar, std::string intoSinglePlayer = "");
    float getProgress();
    bool isDone();
    const std::string& getError();
};

#endif