//
// Normalized [0,1] implementation of AIScoreCalculator
//

#ifndef EAGLE0_NORMALIZEDAISCORECALCULATOR_HPP
#define EAGLE0_NORMALIZEDAISCORECALCULATOR_HPP

#include <memory>

#include "src/main/cpp/net/eagle0/shardok/ai/AIAttackLocations.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/action_point_distances/ActionPointDistancesCache.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"

namespace shardok {

// Forward declarations
class AIScoreCalculator;

using APDCache = std::shared_ptr<ActionPointDistancesCache>;
using ALCache = std::unique_ptr<AttackLocationsCache>;

/// Factory function to create a NormalizedAIScoreCalculator.
/// Returns a unique_ptr to AIScoreCalculator to hide the implementation.
///
/// The normalized scorer produces scores in the range [0, 1] where:
/// - 0.0 = complete defender victory
/// - 1.0 = complete attacker victory
/// - 0.5 = neutral/draw state
///
/// Terminal states (victory/defeat) always return 1.0 or 0.0.
/// Non-terminal states use asymmetric normalization:
/// - If victory condition >= 0:
///   score = (attackerUnits + victoryCondition) / (attackerUnits + defenderUnits +
///   victoryCondition)
/// - If victory condition < 0:
///   score = attackerUnits / (attackerUnits + defenderUnits - victoryCondition)
[[nodiscard]] auto MakeNormalizedAIScoreCalculator(
        const SettingsGetter& settingsGetter,
        const APDCache& apdCache,
        const ALCache& alCache) -> std::unique_ptr<AIScoreCalculator>;

}  // namespace shardok

#endif  // EAGLE0_NORMALIZEDAISCORECALCULATOR_HPP
