#pragma once #include #include #include #include "IModuleSystem.h" #include "IIO.h" using json = nlohmann::json; namespace warfactory { /** * @brief Main engine interface - coordinates everything * * DebugEngine -> Sequential execution, full logging * ProductionEngine -> Optimized execution, minimal overhead * TestEngine -> Isolated execution for unit tests */ class IEngine { public: virtual ~IEngine() = default; /** * @brief Initialize engine with configuration * @param configPath Path to engine configuration file */ virtual void initialize(const std::string& configPath) = 0; /** * @brief Set module execution system * @param moduleSystem Strategy for running modules */ virtual void setModuleSystem(std::shared_ptr moduleSystem) = 0; /** * @brief Set communication system * @param io Communication transport */ virtual void setIO(std::shared_ptr io) = 0; /** * @brief Load modules from configuration * Will scan module directories and load .so files */ virtual void loadModules() = 0; /** * @brief Start main game loop * Blocks until shutdown() called */ virtual void run() = 0; /** * @brief Process single frame/tick * For step debugging and testing */ virtual void step() = 0; /** * @brief Stop engine and cleanup all resources */ virtual void shutdown() = 0; /** * @brief Get engine status and metrics * @return JSON with performance data, loaded modules, etc. */ virtual json getStatus() const = 0; /** * @brief Get engine type identifier */ virtual std::string getEngineType() const = 0; /** * @brief Handle runtime commands (reload module, change config, etc.) * @param command JSON command to execute * @return JSON response */ virtual json handleCommand(const json& command) = 0; }; } // namespace warfactory