#pragma once

#include <string>
#include <vector>
#include <memory>

class AssetLoader;

// LoadingManager: thin facade over AssetLoader for incremental loading.
// Main thread only. Call update() once per frame to perform a single step.
class LoadingManager {
public:
    explicit LoadingManager(AssetLoader* loader);

    // Queue a texture path (relative to base path) for loading.
    void queueTexture(const std::string& path);

    // Start loading (idempotent).
    void start();

    // Perform a single loading step. Returns true when loading complete.
    bool update();

    // Progress in [0,1]
    float getProgress() const;

    // Return and clear any accumulated loading errors.
    std::vector<std::string> getAndClearErrors();

    // Current path being loaded (or empty)
    std::string getCurrentLoading() const;

private:
    AssetLoader* m_loader = nullptr;
    bool m_started = false;
};
