#pragma once
#include "screen.h"
#include "screenTransition.h"

#include <memory>
#include <stack>

namespace quokka_gfx
{
class RendererManager;
//------------------------------------------------------------
class ScreenManager
{
  friend class ScreenTransition;

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

  void setScreen(std::unique_ptr<Screen> screen);      // Set the current screen, replacing any existing screens on the stack
  void pushScreen(std::unique_ptr<Screen> screen);     // Push a new screen onto the stack
  void popScreen();                                    // Pop the current screen from the stack

  void handleEvents();                        // Handle events for the current screen
  void update(double deltaTime);              // Update the current screen
  void render(RendererManager *renderer);     // Render the current screen

  [[nodiscard]] Screen *getCurrentScreen() const;     // Get the current screen

  protected:
  ScreenTransition                    m_screenTransition;     // Screen transition manager
  std::stack<std::unique_ptr<Screen>> m_screenStack;          // Stack of screens
};
//------------------------------------------------------------
}     // namespace quokka_gfx
