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

#ifndef EAGLE0_RELEASEUNITCOMMAND_HPP
#define EAGLE0_RELEASEUNITCOMMAND_HPP

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

namespace shardok {

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

    const UnitId actingUnitId;
    const UnitId releasedUnitId;

public:
    ReleaseUnitCommand(
            const PlayerId playerId,
            const UnitId actingUnitId,
            const UnitId releasedUnitId)
        : ShardokCommand(playerId),
          actingUnitId(actingUnitId),
          releasedUnitId(releasedUnitId){};

    ~ReleaseUnitCommand() override = default;

    [[nodiscard]] auto GetCommandType() const -> CommandType override {
        return net::eagle0::shardok::common::RELEASE_UNIT_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_RELEASEUNITCOMMAND_HPP
