//
// Created by Dan Crosby on 1/5/22.
//

#ifndef EAGLE0_AIWATERCROSSINGCOMMANDCHOOSER_HPP
#define EAGLE0_AIWATERCROSSINGCOMMANDCHOOSER_HPP

#include <utility>
#include <vector>

#include "src/main/cpp/net/eagle0/shardok/library/action_point_distances/ActionPointDistancesCache.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/fb_helpers/FlatbufferWrapper.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/map/CoordsSet.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
#include "src/main/flatbuffer/net/eagle0/shardok/storage/game_state.hpp"
#include "src/main/protobuf/net/eagle0/shardok/api/command_descriptor.pb.h"

namespace shardok {

using CommandProto = net::eagle0::shardok::api::CommandDescriptor;
using GameState = net::eagle0::shardok::storage::fb::GameState;
using Unit = net::eagle0::shardok::storage::fb::Unit;
using ScoreValue = double;

class AIWaterCrossingCommandChooser {
private:
    const PlayerId playerId;
    const APDCache apdCache;

public:
    AIWaterCrossingCommandChooser(const PlayerId pid, APDCache apdCache)
        : playerId(pid),
          apdCache(std::move(apdCache)) {}

    auto StartCrossingFrom(
            const SettingsGetter &settingsGetter,
            const GameState *gameState,
            const CoordsSet &castleCoords) const -> CoordsSet;

    [[nodiscard]] auto WaterCrossingScore(
            const SettingsGetter &settingsGetter,
            const GameState *gameState,
            const CoordsSet &castleCoords,
            const CoordsSet &startCrossingFrom) const -> ScoreValue;
};

}  // namespace shardok

#endif  // EAGLE0_AIWATERCROSSINGCOMMANDCHOOSER_HPP
