#pragma once

#include "../../../include/dv-processing/noise/background_activity_noise_filter.hpp"

#include <pybind11/pybind11.h>

namespace py = pybind11;

/**
 * @brief Binds noise::BackgroundActivityNoiseFilter to python.
 * @param m The module to bind to.
 */
void bind_background_activity_noise_filter(py::module &m) {
	py::class_<dv::noise::BackgroundActivityNoiseFilter<>, std::shared_ptr<dv::noise::BackgroundActivityNoiseFilter<>>>(
		m, "BackgroundActivityNoiseFilter",
		"A background activity noise filter, which test the neighbourhoods of incoming events for other supporting "
		"events that happened within the background activity period.")
		.def(py::init<const cv::Size &, const dv::Duration>(), py::arg("resolution"),
			py::arg("backgroundActivityDuration") = dv::Duration(2000))
		.def("accept", &dv::noise::BackgroundActivityNoiseFilter<>::accept, py::arg("events"),
			"Accepts incoming events.")
		.def("generateEvents", &dv::noise::BackgroundActivityNoiseFilter<>::generateEvents,
			"Apply the filter algorithm and return only the filtered events from the ones that were accepted as input.")
		.def("retain", &dv::noise::BackgroundActivityNoiseFilter<>::retain,
			"Test whether event is of configured polarity.")
		.def("getNumberOfIncomingEvents", &dv::noise::BackgroundActivityNoiseFilter<>::getNumberOfIncomingEvents,
			"Get number of total events that were accepted by the noise filter.")
		.def("getNumberOfOutgoingEvents", &dv::noise::BackgroundActivityNoiseFilter<>::getNumberOfOutgoingEvents,
			"Total number of outgoing events from this filter instance.")
		.def("getReductionFactor", &dv::noise::BackgroundActivityNoiseFilter<>::getReductionFactor,
			"Get the reduction factor of this filter. It's a fraction representation of events that were discard by "
			"this filter compared to the amount of incoming events.")
		.def("getBackgroundActivityDuration",
			&dv::noise::BackgroundActivityNoiseFilter<>::getBackgroundActivityDuration,
			"Get currently configured background activity duration value.")
		.def("setBackgroundActivityDuration",
			&dv::noise::BackgroundActivityNoiseFilter<>::setBackgroundActivityDuration,
			py::arg("backgroundActivityDuration"), "Set new background activity duration value.");
}
