#pragma once

#include "../../../include/dv-processing/data/generate.hpp"

#include <pybind11/pybind11.h>

namespace py = pybind11;

/**
 * @brief Generate data for testing and demonstration purposes.
 */
void bind_generate(py::module &m) {
	using pybind11::operator""_a;

	m.def("sampleImage", &dv::data::generate::sampleImage, "resolution"_a,
		"Generate a sample image (single channel 8-bit unsigned integer) containing a few gray rectangles in a black "
		"background.");
	m.def("eventLine", &dv::data::generate::eventLine, "timestamp"_a, "a"_a, "b"_a, "steps"_a = 0,
		"Generate events along a line between two given end-points.");
	m.def("eventRectangle", &dv::data::generate::eventRectangle, "timestamp"_a, "tl"_a, "br"_a,
		"Generate events along a rectangle edges between two given top-left and bottom right points.");
	m.def("eventTestSet", &dv::data::generate::eventTestSet, "timestamp"_a, "resolution"_a,
		"Generate an event test set that contains event for a few intersecting rectangle edges.");
	m.def("uniformlyDistributedEvents", &dv::data::generate::uniformlyDistributedEvents, "timestamp"_a, "resolution"_a,
		"count"_a, "seed"_a = 0, "Generate a batch of uniformly distributed set of event within the given resolution.");
	m.def("normallyDistributedEvents", &dv::data::generate::normallyDistributedEvents, "timestamp"_a, "center"_a,
		"stddev"_a, "count"_a, "seed"_a = 0,
		"Generate events normally distributed around a given center coordinates with given standard deviation.");
	m.def("uniformEventsWithinTimeRange", &dv::data::generate::uniformEventsWithinTimeRange, "startTime"_a,
		"duration"_a, "resolution"_a, "count"_a, "seed"_a = 0,
		"Generate a batch of uniformly distributed (in pixel-space) randomly generated events. The timestamps are "
		"generated by monotonically increasing the timestamp within the time duration.");
	m.def("dvLogo", &dv::data::generate::dvLogo, "size"_a, "colored"_a = true,
		"bgColor"_a = dv::visualization::colors::white, "pColor"_a = dv::visualization::colors::iniBlue,
		"nColor"_a = dv::visualization::colors::darkGray,
		"Generate a DV logo using simple drawing methods. Generates in color or grayscale.");
	m.def("imageToEvents", &dv::data::generate::imageToEvents, "timestamp"_a, "image"_a, "positive"_a, "negative"_a,
		"Convert an image into event by matching pixel intensities. The algorithm will match all pixel values "
		"available in the and match against positive and negative pixel intensity values, according events are going "
		"to be added into the output event store. Other pixel intensity values are ignored.");
	m.def("dvLogoAsEvents", &dv::data::generate::dvLogoAsEvents, "timestamp"_a, "resolution"_a,
		"Generate a DV logo using simple drawing methods. Generates negative polarity events on the pixels where logo "
		"has dark pixels and positive polarity events where pixels have brighter events.");
	m.def("levelImuMeasurement", &dv::data::generate::levelImuMeasurement, "timestamp"_a,
		"Generate an IMU measurement that measures a camera being on a stable and level surface. All measurement "
		"values are going to be zero, except for Y axis of accelerometer, it will measure -1.0G.");
	m.def("addNoiseToImu", &dv::data::generate::addNoiseToImu, "measurement"_a, "accelerometerStddev"_a,
		"gyroscopeStddev"_a, "seed"_a = 0,
		"Apply noise to imu measurements (accelerometer and gyroscope). The noise is modelled as a normal distribution "
		"with 0 mean and given standard deviation. The modelled noise is added to the given measurement and return a "
		"new dv::IMU structure with added noise.");
	m.def("levelImuWithNoise", &dv::data::generate::levelImuWithNoise, "timestamp"_a, "accelerometerStddev"_a = 0.1f,
		"gyroscopeStddev"_a = 0.1f, "seed"_a = 0,
		"Generate an IMU measurement that measures a camera being on a stable and level surface with additional "
		"measurement noise. The noise is modelled as a normal distribution with 0 mean and given standard deviation.");
}
