#pragma once

#include <string>
#include <vector>

struct ImGuiInputTextCallbackData;

namespace game
{
  class Resources;
}

namespace game::state
{
  class Play;
}

namespace game::developer
{
  namespace console
  {
    int input_callback(ImGuiInputTextCallbackData*);
  }

  class Console
  {
    friend int console::input_callback(ImGuiInputTextCallbackData*);

    std::vector<std::string> history{};
    std::vector<std::string> commandHistory{};
    std::string input{};
    int commandHistoryIndex{-1};
    bool isFocusRequested{};

    void history_push(std::string);
    void command_history_push();
    const std::string& command_history_offset(int offset);
    void help_print(bool isGame);
    void command_execute(Resources&, state::Play*);

  public:
    struct Action
    {
      int character{-1};
      bool isMenu{};
    };

    Action action{};

    void focus_request();
    void update(Resources&, state::Play*);
  };
}
