#pragma once

#include "SceneItem.h"
#include "AbstractGeometricItem.h"
#include "Texture.h"

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

class AbstractMesh;

class SceneModel : public SceneItem
{
public:
    SceneModel() = default;
    virtual ~SceneModel();

    explicit SceneModel(std::unique_ptr<AbstractMesh> mesh);
    explicit SceneModel(std::unique_ptr<AbstractGeometricItem> geometry);

    AbstractGeometricItem* getGeometry() const;
    AbstractMesh* getMesh() const;
    bool getShowOutline() const;
    Type getType() const override;

    void setMeshTransform(const Transform& transform);
    void setShowOutline(bool showOutline);

    void updateGeometry(std::unique_ptr<AbstractGeometricItem> geometry);
    void updateMesh(std::unique_ptr<AbstractMesh> mesh);
    void updateMesh(AbstractMesh* mesh);

private:
    AbstractMesh* mRawMesh{nullptr};
    std::unique_ptr<AbstractMesh> mMesh;
    Transform mMeshTransform;

    std::unique_ptr<Texture> mColorMap;

    std::unique_ptr<AbstractGeometricItem> mGeometry;

    bool mGeometryIsDirty{true};
    bool mShowOutline{false};
};
