// This file is part of GQCG-GQCP.
//
// Copyright (C) 2017-2020  the GQCG developers
//
// GQCG-GQCP is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GQCG-GQCP 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with GQCG-GQCP.  If not, see <http://www.gnu.org/licenses/>.

#include "Basis/NonOrthogonalBasis/UNonOrthogonalStateBasis.hpp"
#include "gqcpy/include/interfaces.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>


namespace py = pybind11;


namespace gqcpy {


// Provide some shortcuts for frequent namespaces.
namespace py = pybind11;
using namespace GQCP;


/**
 *  Add Python bindings for some APIs related to `UNonOrthogonalStateBasis`.
 *
 *  @tparam Class               The type of the Pybind11 `class_` (generated by the compiler).
 *
 *  @param py_class             The Pybind11 `class_` that should obtain APIs related to `UNonOrthogonalStateBasis`.
 */
template <typename Class>
void bindUNonOrthogonalStateBasisInterface(Class& py_class) {

    // The C++ type corresponding to the Python class.
    using Type = typename Class::type;
    using Scalar = typename Type::Scalar;


    /**
     *  MARK: Constructors
     */

    py_class
        .def(py::init<const std::vector<UTransformation<Scalar>>&, const ScalarUSQOneElectronOperator<Scalar>&, const size_t, const size_t, const double>(),
             py::arg("basis_state_vector"),
             py::arg("overlap_operator"),
             py::arg("number_of_occupied_alpha_orbitals"),
             py::arg("number_of_occupied_beta_orbitals"),
             py::arg("zero_threshold") = 1e-8);


    // Expose some Mulliken API to the Python class;
    bindNonOrthogonalStateBasisInterface(py_class);
}


/**
 *  Register `UNonOrthogonalStateBasis_d` and `UNonOrthogonalStateBasis_cd` to the gqcpy module and expose parts of their C++ interfaces to Python.
 *
 *  @param module           The Pybind11 module in which the classes should be registered.
 */
void bindUNonOrthogonalStateBases(py::module& module) {

    // Define the Python class for `UNonOrthogonalStateBasis_d`.
    py::class_<UNonOrthogonalStateBasis<double>> py_UNonOrthogonalStateBasis_d {module, "UNonOrthogonalStateBasis_d", "A class that represents a real, non-orthogonal state basis, created from `unrestricted` states."};

    bindUNonOrthogonalStateBasisInterface(py_UNonOrthogonalStateBasis_d);


    // Define the Python class for `UNonOrthogonalStateBasis_cd`.
    py::class_<UNonOrthogonalStateBasis<complex>> py_UNonOrthogonalStateBasis_cd {module, "UNonOrthogonalStateBasis_cd", "A class that represents a complex, non-orthogonal state basis, created from `unrestricted` states."};

    bindUNonOrthogonalStateBasisInterface(py_UNonOrthogonalStateBasis_cd);
}


}  // namespace gqcpy
