//
// Created by Dan Crosby on 3/23/20.
//

#ifndef EAGLE0_SHARDOK_LIBRARY_VIEW_FILTERS_GAME_STATE_FILTER_HPP
#define EAGLE0_SHARDOK_LIBRARY_VIEW_FILTERS_GAME_STATE_FILTER_HPP

#include <vector>

#include "src/main/cpp/net/eagle0/shardok/library/ShardokCTypes.h"
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"
#include "src/main/flatbuffer/net/eagle0/shardok/storage/game_state.hpp"
#include "src/main/protobuf/net/eagle0/shardok/api/game_state_view.pb.h"

namespace shardok {

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

[[nodiscard]] auto GameStateFilteredForPlayer(
        const SettingsGetter& settings,
        const GameState* gameState,
        PlayerId askingPlayer) -> net::eagle0::shardok::api::GameStateView;

// Variant that takes the asker's allied Shardok pids explicitly. Used for
// non-participant watchers who have no entry in the GameState's player_infos
// but should still see units owned by their participating allies as if those
// units were their own.
[[nodiscard]] auto GameStateFilteredForPlayerWithAllies(
        const SettingsGetter& settings,
        const GameState* gameState,
        PlayerId askingPlayer,
        const std::vector<PlayerId>& alliedPids) -> net::eagle0::shardok::api::GameStateView;

}  // namespace shardok

#endif  // EAGLE0_SHARDOK_LIBRARY_VIEW_FILTERS_GAME_STATE_FILTER_HPP
