//
// Created by sebastian on 29.07.26.
//

#ifndef COLORRACE_ENTITY_H
#define COLORRACE_ENTITY_H
#include <cstdint>
#include <limits>
#include <functional> // <- das hier fehlt vermutlich

namespace engine {
    class Entity {
    public:
        constexpr Entity() noexcept = default;
        constexpr explicit Entity(std::uint32_t id) noexcept : m_id(id) {}

        [[nodiscard]] constexpr std::uint32_t value() const noexcept { return m_id; }

        constexpr bool operator==(const Entity&) const = default;

        static constexpr Entity null() noexcept {
            return Entity{std::numeric_limits<std::uint32_t>::max()};
        }

    private:
        std::uint32_t m_id = std::numeric_limits<std::uint32_t>::max();
    };
}

// Damit Entity in unordered_map als Key funktioniert
template<>
struct std::hash<engine::Entity> {
    std::size_t operator()(const engine::Entity& e) const noexcept {
        return std::hash<std::uint32_t>{}(e.value());
    }
};


#endif //COLORRACE_ENTITY_H
