// Copyright (C) 2026 EDF
// All Rights Reserved
// This code is published under the GNU Lesser General Public License (GNU LGPL)
#pragma once
#include <array>
#include <string>
#include <Eigen/Dense>
#include "test/c++/tools/utils/Capa.h"
#include "test/c++/tools/utils/Tunnel.h"

using typeRet = std::tuple<Eigen::ArrayXd, Eigen::ArrayXd, Eigen::ArrayXd, Eigen::ArrayXXd> ;

/// \brief Calculate using Stan math
/// \param  p_future     array of futures values
/// \param  p_sig        volatilities per factor
/// \param  p_a          mean reverting per factor
/// \param  p_correl     correlations
/// \param  p_nbStep     number of steps
/// \param  p_nbSimul    number of simulations
/// \param  p_batchSize  batch size
/// \param  p_nameArch   file name for simulations
/// \param  p_seed       seed for simulations of OU
/// \param  p_injection  Volume  injection capcity of the storage
/// \param  p_withDrawal Volume  withdrawal capacity
/// \param  p_tunnel     tunnel to respect
/// \param  p_pointStock  initial position in storage
/// \param  p_fileForBellmanAndCont name of file to store continuation values and controls
typeRet calculateSensiUsingControlAdept(const Eigen::ArrayXd   &p_future,  const Eigen::ArrayXd &p_sig, const Eigen::ArrayXd &p_a,
                                        const Eigen::MatrixXd &p_correl, const int &p_nbStep,  const size_t &p_nbSimul, const size_t &p_batchsize,
                                        const std::string   &p_nameArch, int p_seed,
                                        const Capa   &p_injectionVolume, const Capa &p_withDrawalVolume,
                                        const Tunnel &p_tunnel, const Eigen::ArrayXd &p_pointStock, const std::string    &p_fileForBellmanAndCont);
