#pragma once

#include <unordered_map>
#include <string>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

namespace warfactory {

class WorldData {
private:
    json world_state;
    std::unordered_map<std::string, bool> phase_completed;
    std::unordered_map<std::string, bool> step_completed;

public:
    WorldData() = default;

    void setPhaseData(const std::string& phase_name, const json& data);
    json getPhaseData(const std::string& phase_name) const;
    bool hasPhaseData(const std::string& phase_name) const;

    void markPhaseComplete(const std::string& phase_name);
    bool isPhaseComplete(const std::string& phase_name) const;

    void markStepComplete(const std::string& step_name);
    bool isStepComplete(const std::string& step_name) const;

    json& getWorldState() { return world_state; }
    const json& getWorldState() const { return world_state; }

    json exportState() const;
    void importState(const json& state);
};

} // namespace warfactory