#pragma once

#include "../../../entity.hpp"

#include "../../../resource/schema.hpp"
#include "../../../resources.hpp"
#include "../../../util/imgui/entity_button.hpp"

#include "../item_manager.hpp"

#include <imgui.h>

namespace game::state::play
{
  class Autofeed;
}

namespace game::state::play::menu
{
  class Inventory
  {
  public:
    static constexpr auto SIZE = 96.0f;

    std::map<int, int> values{};
    std::unordered_map<int, Entity> actors{};
    std::unordered_map<int, util::imgui::widget::EntityButton> itemButtons{};
    int selectedItemID{-1};

    bool can_upgrade(const resource::xml::Schema&, int itemID);
    bool upgrade(resource::xml::Schema&, int itemID, bool isAll);
    bool upgrade_all_possible(resource::xml::Schema&);
    void update(Resources&, ItemManager&, Entity&, Autofeed&);
    int count();
  };
}
