//
// Created by Dan Crosby on 9/15/20.
//

#ifndef EAGLE0_SHARDOK_UTIL_MAP_LOADER_HPP
#define EAGLE0_SHARDOK_UTIL_MAP_LOADER_HPP

#include <string>
#include <utility>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
#include "src/main/protobuf/net/eagle0/shardok/common/hex_map.pb.h"
#pragma GCC diagnostic pop

using HexMapProto = net::eagle0::shardok::common::HexMap;

class MapNotFoundException : public std::exception {
protected:
    const std::string description;

protected:
    explicit MapNotFoundException(const std::string& n) : description(n + " not found.") {}

public:
    [[nodiscard]] auto what() const noexcept -> const char* override { return description.c_str(); }
};

[[nodiscard]] auto LoadMap(const std::string& mapName) -> HexMapProto;

[[nodiscard]] auto LoadMapFromBytes(const std::string& mapBytes) -> HexMapProto;

[[nodiscard]] auto GetMapNames() -> std::vector<std::string>;

#endif  // EAGLE0_SHARDOK_UTIL_MAP_LOADER_HPP
