#pragma once

#include "SceneItem.h"
#include "Transform.h"

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

struct SceneInfo;

class AbstractVisualNode
{
public:
    AbstractVisualNode(const Transform& transform = {}, const std::string& name = {});

    virtual ~AbstractVisualNode();

    void addChild(AbstractVisualNode* child);

    virtual SceneItem* getSceneItem(std::size_t idx) const;

    virtual std::size_t getNumSceneItems() const;

    const std::vector<AbstractVisualNode*>& getChildren() const;

    const std::string& getName() const;

    bool getIsVisible() const;

    const Transform& getTransform() const;

    void syncChildren(const std::vector<AbstractVisualNode*>& children);

    void setIsVisible(bool isVisible);

    void setName(const std::string& name);

    virtual void setTransform(const Transform& transform);

    virtual void update(SceneInfo* sceneInfo);

protected:
    Transform mTransform;
    std::vector<std::unique_ptr<SceneItem> > mSceneItems;

    std::vector<AbstractVisualNode*> mChildren;

    bool mIsVisible{true};
    bool mTransformIsDirty{true};
    std::string mName;
};
