#pragma once

#include "character/states/CharacterStateBase.h"
#include "character/states/jobs/swordman/SwordmanActionHandler.h"
#include <memory>
#include <string>
#include <unordered_map>

namespace frostbite2D {

class SwordmanAttackState : public CharacterStateBase, public ICharacterActionStateNode {
public:
  SwordmanAttackState();

  bool TryEnter(CharacterStateMachine& machine,
                CharacterStateContext& context) override;
  void OnEnter(CharacterStateMachine& machine,
               CharacterStateContext& context,
               CharacterStateId previousState) override;
  void OnUpdate(CharacterStateMachine& machine,
                CharacterStateContext& context) override;
  void OnExit(CharacterStateMachine& machine,
              CharacterStateContext& context,
              CharacterStateId nextState) override;

private:
  ISwordmanActionHandler* FindHandler(const std::string& actionId) const;

  std::unordered_map<std::string, std::unique_ptr<ISwordmanActionHandler>> handlers_;
};

} // namespace frostbite2D
