//
//  Terrain.hpp
//  eagle0
//
//  Created by Dan Crosby on 9/15/18.
//  Copyright © 2018 none. All rights reserved.
//

#ifndef HexMapTile_hpp
#define HexMapTile_hpp

#include <utility>

#include "src/main/cpp/net/eagle0/shardok/library/map/TileModifier.hpp"
#include "src/main/flatbuffer/net/eagle0/shardok/storage/terrain.hpp"
#include "src/main/protobuf/net/eagle0/shardok/common/terrain.pb.h"

namespace shardok {

using Terrain = net::eagle0::shardok::storage::fb::Terrain;
using TerrainProto = net::eagle0::shardok::common::Terrain;
using TerrainType = net::eagle0::shardok::common::Terrain_Type;

using TerrainType::Terrain_Type_CITY;
using TerrainType::Terrain_Type_FOREST;
using TerrainType::Terrain_Type_HILL;
using TerrainType::Terrain_Type_MOUNTAIN;
using TerrainType::Terrain_Type_NONE;
using TerrainType::Terrain_Type_PLAINS;
using TerrainType::Terrain_Type_RIVER;
using TerrainType::Terrain_Type_STILL_WATER;
using TerrainType::Terrain_Type_SWAMP;
using TerrainType::Terrain_Type_UNKNOWN;

constexpr int kTerrainTypeCount = net::eagle0::shardok::common::Terrain_Type_Type_ARRAYSIZE;

auto AllowsHiding(const Terrain* terrain) -> bool;
auto AllowsHiding(net::eagle0::shardok::storage::fb::Terrain_::Type type) -> bool;
auto AllowsHiding(const net::eagle0::shardok::storage::fb::TileModifier& modifier) -> bool;

auto AllowsHiding(const TerrainProto& terrain) -> bool;
auto AllowsHiding(TerrainType type) -> bool;
auto AllowsHiding(const TileModifierProto& modifier) -> bool;

auto AllowsFortification(const Terrain* terrain) -> bool;

auto IsWater(net::eagle0::shardok::storage::fb::Terrain_::Type type) -> bool;
auto IsWater(TerrainType type) -> bool;

auto IsTraversible(const net::eagle0::shardok::storage::fb::Terrain& terrain) -> bool;

auto MakeHexMapTerrain(TerrainType tp, TileModifierProto mod = TileModifierProto()) -> TerrainProto;
auto MakeHexMapTerrain(
        net::eagle0::shardok::storage::fb::Terrain_::Type tp,
        const net::eagle0::shardok::storage::fb::TileModifier& mod =
                net::eagle0::shardok::storage::fb::TileModifier()) -> Terrain;

}  // namespace shardok

#endif /* HexMapTile_hpp */
