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

#ifndef EAGLE0_PLACEHIDDENUNITCOMMAND_HPP
#define EAGLE0_PLACEHIDDENUNITCOMMAND_HPP

#include <optional>
#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/flatbuffer/net/eagle0/shardok/storage/unit.hpp"

namespace shardok {

using Unit = net::eagle0::shardok::storage::fb::Unit;

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

    const UnitId actorId;
    const Coords target;
    const int minimumKnowledge;

public:
    PlaceHiddenUnitCommand(
            const PlayerId playerId,
            const UnitId actorId,
            const Coords& target,
            const int minimumKnowledge)
        : ShardokCommand(playerId),
          actorId(actorId),
          target(target),
          minimumKnowledge(minimumKnowledge){};

    ~PlaceHiddenUnitCommand() override = default;

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

    auto GetCommandProto() const -> CommandProto override;
};
}  // namespace shardok

#endif  // EAGLE0_PLACEHIDDENUNITCOMMAND_HPP
