#pragma once

#include <SDL2/SDL_gamecontroller.h>

namespace ns_game {

struct InputState {
  float moveX = 0.0f;
  bool jumpPressed = false;
  bool attackPressed = false;
};

class InputStateProvider {
public:
  InputStateProvider();
  ~InputStateProvider();

  InputStateProvider(const InputStateProvider&) = delete;
  InputStateProvider& operator=(const InputStateProvider&) = delete;

  InputState Sample();

private:
  void ensureController();

  SDL_GameController* controller_ = nullptr;
  bool jumpHeldLastFrame_ = false;
  bool attackHeldLastFrame_ = false;
};

} // namespace ns_game
