#pragma once

#include <chrono>
#include <entt/entt.hpp>
#include <glm/glm.hpp>

namespace tw::net {


class EntityPositionInterpolator {

    using Clock = std::chrono::high_resolution_clock;

    entt::registry* m_registry;

    size_t m_bufferingIntervalInMillis;

    glm::vec3 get_position(Clock::time_point time_point, entt::entity entity);

public:
    EntityPositionInterpolator(
        entt::registry* registry,
        size_t bufferingIntervalInMillis);

    void register_entity(entt::entity entity);

    void set_position(Clock::time_point time_point, entt::entity entity, glm::vec3 position);

    void interpolate_smoothed_entities(Clock::time_point time_point);
};

}
