// docker-finance | modern accounting for the power-user
//
// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! \file
//! \author Aaron Fiore (Founder, Evergreen Crypto LLC)
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
//! \since docker-finance 1.0.0

#ifndef CONTAINER_SRC_ROOT_MACRO_COMMON_UTILITY_HH_
#define CONTAINER_SRC_ROOT_MACRO_COMMON_UTILITY_HH_

#include <initializer_list>
#include <string>

#include "../../common/utility.hh"

//! \namespace dfi
//! \since docker-finance 1.0.0
namespace dfi
{
//! \namespace dfi::macro
//! \brief ROOT macros
//! \since docker-finance 1.0.0
namespace macro
{
//! \namespace dfi::macro::common
//! \brief Shared ROOT macro-related functionality
//! \since docker-finance 1.0.0
namespace common
{
//! \brief Load macro file by path
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::load("macro/test/unit.C")<br>
//!
//!   Will load:
//!     <br>&emsp; root/macro/test/unit.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \todo Refactor with dfi::common::Pluggable
//! \ingroup cpp_macro_impl
void load(const std::string& path)
{
  ::dfi::common::load(path);
}

//! \brief Load macro files by list of paths
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::load({"macro/test/unit.C", "macro/test/benchmark.C"})<br>
//!
//!   Will load:
//!     <br>&emsp; root/macro/test/unit.C and root/macro/test/benchmark.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \ingroup cpp_macro_impl
//! \todo Refactor with dfi::common::Pluggable
void load(const std::initializer_list<std::string>& paths)
{
  ::dfi::common::load(paths);
}

//! \brief Unload macro file by path
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::unload("macro/test/unit.C")<br>
//!
//!   Will unload:
//!     <br>&emsp; root/macro/test/unit.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \ingroup cpp_macro_impl
//! \todo Refactor with dfi::common::Pluggable
void unload(const std::string& path)
{
  ::dfi::common::unload(path);
}

//! \brief Unload macro files by list of paths
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::unload({"macro/test/unit.C", "macro/test/benchmark.C"})<br>
//!
//!   Will unload:
//!     <br>&emsp; root/macro/test/unit.C and root/macro/test/benchmark.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \ingroup cpp_macro_impl
//! \todo Refactor with dfi::common::Pluggable
void unload(const std::initializer_list<std::string>& paths)
{
  ::dfi::common::unload(paths);
}

//! \deprecated This will be removed in the v2 API; use the `dfi::common` free functions instead
//! \todo Remove in 2.0.0
//! \since docker-finance 1.0.0
class Command : public ::dfi::common::Command
{
};

//! \brief Reload macro file by path
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::reload("macro/test/unit.C")<br>
//!
//!   Will reload:
//!     <br>&emsp; root/macro/test/unit.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \ingroup cpp_macro_impl
//! \todo Refactor with dfi::common::Pluggable
void reload(const std::string& path)
{
  ::dfi::common::reload(path);
}

//! \brief Reload macro files by list of paths
//! \ingroup cpp_macro_impl
//! \details
//!   Example:
//!     <br>&emsp; root [0] dfi::macro::reload({"macro/test/unit.C", "macro/test/benchmark.C"})<br>
//!
//!   Will reload:
//!     <br>&emsp; root/macro/test/unit.C and root/macro/test/benchmark.C<br>
//!
//! \note Parent directory is `root` by default but accepts absolute paths outside of `root`
//! \todo Refactor with dfi::common::Pluggable
void reload(const std::initializer_list<std::string>& paths)
{
  ::dfi::common::reload(paths);
}

//! \deprecated This will be removed in the v2 API; use the `dfi::common` free function instead
//! \todo Remove in 2.0.0
//! \since docker-finance 1.0.0
std::string get_env(const std::string& var)
{
  return ::dfi::common::get_env(var);
}

//! \deprecated This will be removed in the v2 API; use the `dfi::common` free function instead
//! \todo Remove in 2.0.0
//! \since docker-finance 1.0.0
int exec(const std::string& cmd)
{
  return ::dfi::common::exec(cmd);
}

//! \deprecated This will be removed in the v2 API; use the `dfi::common` free function instead
//! \todo Remove in 2.0.0
//! \since docker-finance 1.0.0
std::string make_timestamp()
{
  return ::dfi::common::make_timestamp();
}
}  // namespace common

//! \brief Convenience wrapper to inner common loader
//! \ref dfi::macro::common::load(const std::string& path)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void load(const std::string& path)
{
  common::load(path);
}
//! \brief Convenience wrapper to inner common loader
//! \ref dfi::macro::common::load(const std::initializer_list<std::string>& paths)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void load(const std::initializer_list<std::string>& paths)
{
  common::load(paths);
}

//! \brief Convenience wrapper to inner common unloader
//! \ref dfi::macro::common::unload(const std::string& path)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void unload(const std::string& path)
{
  common::unload(path);
}
//! \brief Convenience wrapper to inner common unloader
//! \ref dfi::macro::common::unload(const std::initializer_list<std::string>& paths)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void unload(const std::initializer_list<std::string>& paths)
{
  common::unload(paths);
}

//! \brief Convenience wrapper to inner common reloader
//! \ref dfi::macro::common::reload(const std::string& path)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void reload(const std::string& path)
{
  common::reload(path);
}
//! \brief Convenience wrapper to inner common reloader
//! \ref dfi::macro::common::reload(const std::initializer_list<std::string>& paths)
//! \ingroup cpp_macro
//! \since docker-finance 1.1.0
//! \todo Refactor with dfi::common::Pluggable
void reload(const std::initializer_list<std::string>& paths)
{
  common::reload(paths);
}

}  // namespace macro
}  // namespace dfi

#endif  // CONTAINER_SRC_ROOT_MACRO_COMMON_UTILITY_HH_

// # vim: sw=2 sts=2 si ai et
