#include <vector>
#include <string>
#include <random>
#include "ising.hpp"

#ifndef SCHEDULING_HPP
#define SCHEDULING_HPP

class Scheduler {
public:
    // Construction & Initialization
    Scheduler(int numThreads, std::string outPutDir, bool recordEvolution = true);
    void addRun(int size, double temperature, int cycles, bool randomInit, int N_duplicates = 1);

    // Execution Control
    void start();

    // Stochastic Configuration
    void setMasterSeed(int seed) { masterSeed = seed; seedGen.seed(masterSeed); }


private:
    // Internal State
    int numThreads;
    std::string outPutDir;
    bool recordEvolution;

    int masterSeed = 42;
    std::mt19937 seedGen;

    struct RunConfig {
        int size;
        double temperature;
        int cycles;
        bool randomInit;
        int seed;
        int duplicateID;
    };

    std::vector<RunConfig> runQueue;

    // Internal Helpers
    std::string getOutputFileName(const RunConfig& config, bool isEvolution) const;
    void executeRun(const RunConfig& config);
};
#endif
