#pragma once

#include "entt/entt.hpp"
#include <cstdint>
#include <map>
#include <optional>

namespace tw::net {

class EntityIdMap {
public:
    const bool is_server_entity_registered(uint32_t server_id) const {
        return m_mappings.find(server_id) != m_mappings.end();
    }

    const std::optional<entt::entity> get_local(uint32_t server_id) const {
        if(is_server_entity_registered(server_id)) {
            return m_mappings.find(server_id)->second;
        }

        return {};
    }

    void register_server_to_local(uint32_t server_id, entt::entity local) {
        m_mappings[server_id] = local;
    }

private:
    std::map<uint32_t, entt::entity> m_mappings;
};

}
