//
// Abstract game state interface for MCTS
//

#ifndef EAGLE0_MCTS_GAME_STATE_HPP
#define EAGLE0_MCTS_GAME_STATE_HPP

#include <cstdint>
#include <memory>
#include <string>

#include "MCTSTypes.hpp"

namespace shardok {
namespace mcts {

// Abstract interface for game states
class MCTSGameState {
public:
    virtual ~MCTSGameState() = default;

    // Compute hash for transposition table
    [[nodiscard]] virtual uint64_t hash() const = 0;

    // Evaluate the state from the perspective of the given player
    [[nodiscard]] virtual double score(MCTSPlayerId playerId) const = 0;

    // Get the player whose turn it is
    [[nodiscard]] virtual MCTSPlayerId currentPlayerId() const = 0;

    // Check if the game has ended
    [[nodiscard]] virtual bool isTerminal() const = 0;

    // Create a deep copy of the state
    [[nodiscard]] virtual std::unique_ptr<MCTSGameState> clone() const = 0;

    // Check if two states are equivalent
    [[nodiscard]] virtual bool equals(const MCTSGameState& other) const = 0;

    // Get winner if terminal, or -1 if not terminal or draw
    [[nodiscard]] virtual MCTSPlayerId getWinner() const = 0;

    // Optional: Get a string representation for debugging
    [[nodiscard]] virtual std::string toString() const { return "MCTSGameState"; }
};

}  // namespace mcts
}  // namespace shardok

#endif  // EAGLE0_MCTS_GAME_STATE_HPP