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

#ifndef EAGLE0_EXTINGUISHFIRECOMMAND_HPP
#define EAGLE0_EXTINGUISHFIRECOMMAND_HPP

#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 ExtinguishFireCommand : public ShardokCommand {
private:
    [[nodiscard]] auto ExecuteWithRoll(const GameStateW& currentState, double roll) const
            -> vector<ActionResult>;

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

    const SettingsGetter settings;
    const UnitId actorId;
    const Coords target;
    const PercentileRollOdds odds;

public:
    ExtinguishFireCommand(
            const SettingsGetter& getter,
            PlayerId playerId,
            UnitId actorId,
            Coords target,
            PercentileRollOdds odds);

    ~ExtinguishFireCommand() override = default;

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

    [[nodiscard]] auto GetCommandProto() const -> CommandProto override;
    [[nodiscard]] auto CanDoWithLowMorale() const -> bool override { return true; }

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

#endif  // EAGLE0_EXTINGUISHFIRECOMMAND_HPP
