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

#ifndef EAGLE0_RAISEDEADCOMMAND_HPP
#define EAGLE0_RAISEDEADCOMMAND_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/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"

namespace shardok {

class RaiseDeadCommand : 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 PercentileRollOdds odds;
    const int wisdomXp;
    const int charismaXp;
    const int minimumKnowledge;
    const SettingsGetter settings;

public:
    RaiseDeadCommand(
            const ActionCost& cost,
            const PlayerId playerId,
            const UnitId actorId,
            const Coords target,
            PercentileRollOdds odds,
            const int wisdomXp,
            const int charismaXp,
            const int minimumKnowledge,
            const SettingsGetter& settingsGetter)
        : ShardokCommand(playerId),
          cost(cost),
          actorId(actorId),
          target(target),
          odds(std::move(odds)),
          wisdomXp(wisdomXp),
          charismaXp(charismaXp),
          minimumKnowledge(minimumKnowledge),
          settings(settingsGetter){};

    ~RaiseDeadCommand() override = default;

    [[nodiscard]] auto ExecuteWithRoll(const GameStateW& currentState, double roll) const
            -> vector<ActionResult>;

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

    [[nodiscard]] auto HasOdds() const -> bool override { return true; }
    [[nodiscard]] auto GetOddsPercentile() const -> int32_t override;
};
}  // namespace shardok
#endif  // EAGLE0_RAISEDEADCOMMAND_HPP
