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

#ifndef EAGLE0_CONTROLCOMMAND_HPP
#define EAGLE0_CONTROLCOMMAND_HPP

#include <utility>

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

namespace shardok {

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

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

    const UnitId actorId;
    const UnitId targetId;

public:
    explicit ControlCommand(const PlayerId playerId, const UnitId actorId, const UnitId targetId)
        : ShardokCommand(playerId),
          actorId(actorId),
          targetId(targetId){};

    ~ControlCommand() override = default;

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

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

#endif  // EAGLE0_CONTROLCOMMAND_HPP
