#pragma once

#include "../../../include/dv-processing/features/redetection_strategy.hpp"

#include <pybind11/pybind11.h>

namespace py = pybind11;

/**
 * @brief Bind features::NoRedetection, FeatureCountRedetection, UpdateIntervalRedetection,
 * UpdateIntervalOrFeatureCountRedetection to python
 * @param m pybind The module to bind to
 */
void bind_redetection_strategy(py::module &m) {
	py::class_<dv::features::NoRedetection>(m, "NoRedetection", "No redetection strategy.")
		.def(py::init<>())
		.def("decideRedetection", &dv::features::NoRedetection::decideRedetection);

	py::class_<dv::features::FeatureCountRedetection>(
		m, "FeatureCountRedetection", "Redetection strategy based on number of features.")
		.def(py::init<float>(), py::arg("numberOfFeatures"),
			"Redetection strategy based on number of features. Pass feature count coefficient, redetection is "
			"performed when feature count goes lower than the given proportion of maximum tracks, redetection will be "
			"executed.")
		.def("decideRedetection", &dv::features::FeatureCountRedetection::decideRedetection, py::arg("tracker"),
			"Check whether to perform redetection.");

	py::class_<dv::features::UpdateIntervalRedetection>(
		m, "UpdateIntervalRedetection", "Redetection strategy based on interval from last detection.")
		.def(py::init([](const dv::Duration updateInterval) {
			return dv::features::UpdateIntervalRedetection(updateInterval);
		}))
		.def("decideRedetection", &dv::features::UpdateIntervalRedetection::decideRedetection, py::arg("tracker"),
			"Check whether to perform redetection.");

	py::class_<dv::features::UpdateIntervalOrFeatureCountRedetection>(m, "UpdateIntervalOrFeatureCountRedetection",
		"Redetection strategy based on interval from last detection or minimum number of tracks. This class combines"
		" redetection logic from UpdateIntervalRedetection and FeatureCountRedetection.")
		.def(py::init([](const dv::Duration updateInterval, const float numberOfFeatures) {
			return dv::features::UpdateIntervalOrFeatureCountRedetection(updateInterval, numberOfFeatures);
		}))
		.def("decideRedetection", &dv::features::UpdateIntervalOrFeatureCountRedetection::decideRedetection,
			py::arg("tracker"), "Check whether to perform redetection.");
}
