#pragma once

#include <UART_Interface.hpp>

#define HIDDEN_BUFFER_SIZE 2048

#define IGNORE_UNUSED(x) \
	if(&x == &x)         \
	{                    \
	}

class UARTSpy : public UART
{
  public:
	UARTSpy();

	void transmit(const uint8_t transmit_buffer[], size_t transmit_size) final;

	void transmit(const std::string_view to_transmit) final;

	void receive(uint8_t receive_buffer[], size_t receive_size, const UART::cb_t& rx_callback,
				 std::chrono::milliseconds receive_timeout_ms = std::chrono::milliseconds(0));

	size_t TransmittedBytes(uint8_t buf[], size_t buf_size);

	void PutBytesInRcvBuf(const uint8_t buf[], size_t buf_bytes);

	void ClearBuffers();

  private:
	struct fakeBuffer
	{
		char buf[HIDDEN_BUFFER_SIZE];
		size_t bytes;
	};
	struct fakeBuffer _xmitBuffer;
	struct fakeBuffer _rcvBuffer;
};