//
// Created by Dan Crosby on 11/25/20.
//

#ifndef EAGLE0_ENDPLAYERSETUPCOMMAND_HPP
#define EAGLE0_ENDPLAYERSETUPCOMMAND_HPP

#include <optional>
#include <utility>

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

namespace shardok {

class EndPlayerSetupCommand : public ShardokCommand {
private:
    const PlayerId nextPid;
    const GameStateW gameState;
    const SettingsGetter settings;

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

public:
    explicit EndPlayerSetupCommand(
            const PlayerId playerId,
            const PlayerId nextPid,
            GameStateW gameState,
            const SettingsGetter& settingsGetter)
        : ShardokCommand(playerId),
          nextPid(nextPid),
          gameState(gameState),
          settings(settingsGetter){};

    ~EndPlayerSetupCommand() override = default;

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

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

#endif  // EAGLE0_ENDPLAYERSETUPCOMMAND_HPP
