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

#ifndef EAGLE0_PLACEUNITCOMMAND_HPP
#define EAGLE0_PLACEUNITCOMMAND_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/flatbuffer/net/eagle0/shardok/storage/unit.hpp"

namespace shardok {

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

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

    const Unit* actor;
    const Coords target;

public:
    PlaceUnitCommand(const Unit* actor, const Coords target)
        : ShardokCommand(actor->player_id()),
          actor(actor),
          target(target){};

    ~PlaceUnitCommand() override = default;

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

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

#endif  // EAGLE0_PLACEUNITCOMMAND_HPP
