#pragma once
#include "ai.hpp"

#include "gui/fsm.hpp"

struct InventoryStats;

struct Autowalker {
  int enemy_count = 0;
  int item_count = 0;
  int device_count = 0;
  bool map_opened_once = false;
  bool weapon_crafted = false;
  gui::FSM& fsm;

  Autowalker(gui::FSM& fsm)
    : fsm(fsm) {}

  void autowalk();
  void start_autowalk();
  void craft_weapon();
  void open_map();

  void handle_window_events();
  void handle_boss_fight();
  void handle_player_walk(ai::State& start, ai::State& goal);

  void send_event(gui::Event ev);
  void process_combat();
  bool path_player(Pathing& paths, Point &target_out);
  void path_fail(Matrix& bad_paths, Point pos);
  Point get_current_position();
  void rotate_player(Point current, Point target);
  void process_move(Pathing& paths);
  void log(std::wstring msg);
  void status(std::wstring msg);
  void close_status();
  bool player_health_good();
  void player_use_healing();
  InventoryStats player_item_count();
  ai::State update_state(ai::State start);

  Pathing path_to_enemies();
  Pathing path_to_items();
};
