//
// Created by Dan Crosby on 5/30/20.
//

#ifndef EAGLE0_SCOUTCOMMAND_HPP
#define EAGLE0_SCOUTCOMMAND_HPP

#include <utility>

#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"

namespace shardok {

class ScoutCommand : public ShardokCommand {
protected:
    [[nodiscard]] auto InternalExecute(
            const GameStateW& currentState,
            const std::shared_ptr<RandomGenerator>& generator) const
            -> vector<ActionResult> override;

    const ActionCost cost;
    const UnitId actorId;
    const Coords target;
    const PercentileRollOdds odds;
    const int scoutDirectKnowledgeIncrement;
    const int scoutAdjacentKnowledgeIncrement;
    const int agilityXp;
    const int wisdomXp;

public:
    ScoutCommand(
            const ActionCost& cost,
            const PlayerId playerId,
            const UnitId actorId,
            const Coords target,
            PercentileRollOdds odds,
            const int scoutDirectKnowledgeIncrement,
            const int scoutAdjacentKnowledgeIncrement,
            const int agilityXp,
            const int wisdomXp)
        : ShardokCommand(playerId),
          cost(cost),
          actorId(actorId),
          target(target),
          odds(std::move(odds)),
          scoutDirectKnowledgeIncrement(scoutDirectKnowledgeIncrement),
          scoutAdjacentKnowledgeIncrement(scoutAdjacentKnowledgeIncrement),
          agilityXp(agilityXp),
          wisdomXp(wisdomXp){};

    ~ScoutCommand() override = default;

    [[nodiscard]] auto ExecuteWithRoll(const GameStateW& currentState, double roll) const
            -> vector<ActionResult>;

    auto GetCommandType() const -> CommandType override {
        return net::eagle0::shardok::common::SCOUT_COMMAND;
    }

    auto GetCommandProto() const -> CommandProto override;

    [[nodiscard]] auto CanBeFollowUp() const -> bool override { return true; }
    [[nodiscard]] auto CanDoWithLowMorale() const -> bool override { return false; }
    [[nodiscard]] auto CanDoWhileStunned() const -> bool override { return false; }
    [[nodiscard]] auto CanDoWithLowVigor() const -> bool override { return false; }
    [[nodiscard]] auto CanDoAfterMovingIntoZoc() const -> bool override { return false; }
    [[nodiscard]] auto IsRequiredToEndTurn() const -> bool override { return false; }
    [[nodiscard]] auto HasOdds() const -> bool override { return true; }
    [[nodiscard]] auto GetOddsPercentile() const -> int32_t override;
};
}  // namespace shardok

#endif  // EAGLE0_SCOUTCOMMAND_HPP
