//
// Created by m on 12/13/21.
//

#ifndef RLA_IIPP_ALGORITHMMANAGER_HPP
#define RLA_IIPP_ALGORITHMMANAGER_HPP
#include <sol/sol.hpp>
#include <range/v3/view.hpp>
struct DungeonAlgorithm {
    unsigned int frames_per_update=1;
    sol::function update;
    sol::function initialize;
    std::string name;
};

class AlgorithmManager {
private:
    std::vector<DungeonAlgorithm> algorithms;
    unsigned int target_fps=1;
public:
    void register_algorithm(std::string name, sol::function initialize, sol::function update, unsigned int updates_per_second);

    void setTargetFps(unsigned int targetFps) {
        target_fps = targetFps;
    }

    ranges::any_view<DungeonAlgorithm> get_algorithms();

    explicit AlgorithmManager(unsigned int targetFps) : target_fps(targetFps) {}

    AlgorithmManager() = default;
};


#endif //RLA_IIPP_ALGORITHMMANAGER_HPP
