#pragma once

#include <SDL3/SDL.h>

#include <memory>  // Para shared_ptr
#include <vector>  // Para vector

#include "game/entities/moving_platform.hpp"  // Para MovingPlatform, MovingPlatform::Data

class SolidActorManager;

class PlatformManager {
   public:
    explicit PlatformManager(SolidActorManager* solid_actors);
    ~PlatformManager() = default;

    // Prohibir copia y movimiento
    PlatformManager(const PlatformManager&) = delete;
    auto operator=(const PlatformManager&) -> PlatformManager& = delete;
    PlatformManager(PlatformManager&&) = delete;
    auto operator=(PlatformManager&&) -> PlatformManager& = delete;

    // Gestión de plataformas
    void addPlatform(std::shared_ptr<MovingPlatform> platform);
    void clear();
    [[nodiscard]] auto isEmpty() const -> bool;

    // Actualización y renderizado
    void update(float delta_time);
    void render();

#ifdef _DEBUG
    void updateAnimations(float delta_time);
    void resetPositions(const std::vector<MovingPlatform::Data>& platform_data);
    [[nodiscard]] auto getCount() const -> int;
    auto getPlatform(int index) -> std::shared_ptr<MovingPlatform>&;
    void removeLastPlatform();
#endif

   private:
    std::vector<std::shared_ptr<MovingPlatform>> platforms_;
    SolidActorManager* solid_actors_{nullptr};  // Referencia no propietaria al SolidActorManager de la Room
};
