#pragma once

#include <flecs.h>
#include <memory>

namespace Ogre {
    class SceneManager;
}

class ProceduralTextureSystem {
public:
    ProceduralTextureSystem(flecs::world& world, Ogre::SceneManager* sceneMgr);
    ~ProceduralTextureSystem();
    
    // Initialize the system
    void initialize();
    
    // Main update - generates dirty textures
    void update();
    
    // Force regenerate a specific texture
    void regenerateTexture(flecs::entity entity);
    
    // Get the generated texture name for an entity
    std::string getTextureName(flecs::entity entity);
    
private:
    flecs::world& m_world;
    Ogre::SceneManager* m_sceneMgr;
    
    flecs::query<struct ProceduralTextureComponent> m_query;
    
    bool m_initialized = false;

    // Generate the texture for a component
    void generateTexture(flecs::entity entity, struct ProceduralTextureComponent& component);
};
