#pragma once

#include "utils/Colors.h"
#include "utils/Coords.h"

#include <SDL3/SDL.h>
#include <memory>

namespace quokka_gfx
{
class Window;
//--------------------------------------------------------------
class Renderer
{
  public:
  using pRenderer = std::unique_ptr<Renderer>;     // Unique pointer type for Renderer

  public:
  Renderer() = delete;                                       // Default constructor
  virtual ~Renderer();                                       // Default destructor
  Renderer(const Renderer &obj)                = delete;     // Copy constructor
  Renderer(Renderer &&obj) noexcept            = delete;     // Move constructor
  Renderer &operator=(const Renderer &obj)     = delete;     // Copy assignment operator
  Renderer &operator=(Renderer &&obj) noexcept = delete;     // Move assignment operator

  explicit Renderer(const Window &window);     // Constructor

  // Accessors
  [[nodiscard]] SDL_Renderer *getNativeRenderer() const noexcept;     // Get the native SDL renderer

  // Rendering cycle functions
  void clear() const;       // Clear the rendering target
  void present() const;     // Present the rendered content to the window

  // Setting functions
  void setDrawColor(const Color &color) const;     // Set the drawing color (default to white)

  // Drawing functions
  void drawLine(const FPos &start, const FPos &end) const;       // Draw a line
  void drawRect(const FPos &start, const FSize &size) const;     // Draw a rectangle outline
  void fillRect(const FPos &start, const FSize &size) const;     // Draw a filled rectangle

  protected:
  const Window &m_owner;     // Reference to the owner window

  SDL_Renderer *m_nativeRenderer = nullptr;     // Native SDL renderer pointer
};
//--------------------------------------------------------------
}     // namespace quokka_gfx
