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

#ifndef EAGLE0_REPAIRCOMMAND_HPP
#define EAGLE0_REPAIRCOMMAND_HPP

#include <utility>

#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"
#include "src/main/protobuf/net/eagle0/shardok/common/terrain.pb.h"

namespace shardok {

using TerrainProto = net::eagle0::shardok::common::Terrain;
using TileModifierProto = net::eagle0::shardok::common::TileModifier;

class RepairCommand : 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 int agilityXp;
    const int strengthXp;
    const int minimumKnowledge;
    const double repairBuf;

public:
    RepairCommand(
            const ActionCost& cost,
            const PlayerId playerId,
            const UnitId actorId,
            const Coords target,
            const int agilityXp,
            const int strengthXp,
            const int minimumKnowledge,
            const double repairBuf)
        : ShardokCommand(playerId),
          cost(cost),
          actorId(actorId),
          target(target),
          agilityXp(agilityXp),
          strengthXp(strengthXp),
          minimumKnowledge(minimumKnowledge),
          repairBuf(repairBuf){};

    ~RepairCommand() override = default;

    [[nodiscard]] auto GetCommandType() const -> CommandType override {
        return net::eagle0::shardok::common::REPAIR_COMMAND;
    }

    auto GetCommandProto() const -> CommandProto override;

    [[nodiscard]] auto IsRequiredToEndTurn() const -> bool override { return false; }
    [[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; }
};
}  // namespace shardok

#endif  // EAGLE0_REPAIRCOMMAND_HPP
