// Copyright (C) 2026 EDF
// All Rights Reserved
// This code is published under the GNU Lesser General Public License (GNU LGPL)
#include <pybind11/pybind11.h>
#include "StOpt/core/utils/version.h"

namespace py = pybind11;

//  declare functons defined elsewhere
void initOptimizers(py::module_ &);
void initSimulators(py::module_ &);
void initUtils(py::module_ &);
#ifdef SDDPPYTHON
void initSDDPOptimizers(py::module_ &);
void initSDDPSimulators(py::module_ &);
void initSDDPUnitTest(py::module_ &);
#endif

PYBIND11_MODULE(pystopttest, m)
{
    m.doc() = "Bindings Pybind11 for StOpt tests";
    // version
    m.def("getVersion", StOpt::getStOptVersion);

    // Submodule
    auto mOptimizers        = m.def_submodule("optimizers",         "Optimizers  module");
    auto mSimulators        = m.def_submodule("simulators",         "Simulators  module");
    auto mUtils             = m.def_submodule("utils",              "Utils  module");
    // initialisation
    initOptimizers(mOptimizers);
    initSimulators(mSimulators);
    initUtils(mUtils);
#ifdef SDDPPYTHON
    auto mSDDPOptimizers         = m.def_submodule("SDDPOptimizers", "stochastic dual dynamic programming  optimizers  module");
    auto mSDDPSimulators         = m.def_submodule("SDDPSimulators", "stochastic dual dynamic programming  simulators  module");
    auto mSDDPUnitTest         = m.def_submodule("SDDPUnitTest", "stochastic dual dynamic programming  unit test module");
    initSDDPOptimizers(mSDDPOptimizers);
    initSDDPSimulators(mSDDPSimulators);
    initSDDPUnitTest(mSDDPUnitTest);
#endif
}
