#pragma once

#include <object/components/component.hpp>
#include <state/gamestate.hpp>
#include <unordered_set>

namespace Game::Object::Components {
    struct BoxColliderBounds {
        float left, right, top, bottom;
    };

    class BoxCollider : public Component {
        public:
            BoxCollider() = default;
            BoxCollider(const BoxCollider&);
            BoxCollider& operator=(const BoxCollider&);
            BoxCollider(BoxCollider&&) noexcept;
            BoxCollider& operator=(BoxCollider&&) noexcept;
            ~BoxCollider() override;

            void start(Object::Entity* thisEntity) override;
            void update(float deltaTime, Object::Entity* thisEntity) override;

            void setScale(float scale) { mScale = scale; }
            float getScale() const { return mScale; }
            BoxColliderBounds getBounds() const { return mBounds; }
            bool isColliding() const { return !mCollidingWith.empty(); }

        private:
            float mScale = 1.f;
            BoxColliderBounds mBounds{0.f, 0.f, 0.f, 0.f};
            std::unordered_set<Object::Entity*> mCollidingWith; // Track collisions per-entity so enter/stay/exit callbacks remain correct with multiple colliders
    };
}