//
// Created by dancrosby on 3/4/20.
//

#ifndef EAGLE0_AISCORECALCULATOR_HPP
#define EAGLE0_AISCORECALCULATOR_HPP

#include <future>

#include "src/main/cpp/net/eagle0/shardok/ai/AIAttackLocations.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/GameStateW.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCTypes.h"
#include "src/main/cpp/net/eagle0/shardok/library/action_point_distances/ActionPointDistancesCache.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/map/CoordsSet.hpp"
#include "src/main/protobuf/net/eagle0/shardok/api/command_descriptor.pb.h"

namespace shardok {

using shardok::PlayerId;
using std::future;
using std::vector;

using ScoreValue = double;
using CommandProto = net::eagle0::shardok::api::CommandDescriptor;

// Forward declarations
class ShardokEngine;
struct AIStrategy;

/// Abstract base class for AI scoring algorithms.
/// Allows testing different scoring strategies by implementing different scorers.
class AIScoreCalculator {
public:
    virtual ~AIScoreCalculator() = default;

    // Rule of five: explicitly default or delete copy/move operations
    AIScoreCalculator(const AIScoreCalculator &) = default;
    AIScoreCalculator &operator=(const AIScoreCalculator &) = default;
    AIScoreCalculator(AIScoreCalculator &&) = default;
    AIScoreCalculator &operator=(AIScoreCalculator &&) = default;

protected:
    AIScoreCalculator() = default;

public:
    /// Evaluate the score of a guessed game state based on the current AI strategy.
    /// DOES NOT perform lookahead - this is pure state evaluation.
    /// For lookahead search, use AICommandEvaluator which depends on this interface.
    [[nodiscard]] virtual auto GuessedStateScore(
            bool isDefender,
            const GameStateW &state,
            const AIStrategy &aiStrategy,
            const CoordsSet &allCastleCoords) const -> ScoreValue = 0;
};

}  // namespace shardok

#endif  // EAGLE0_AISCORECALCULATOR_HPP
