#pragma once

#include "Component.h"
#include <string>
#include <glm/glm.hpp>
#include "../core/utils/AssetManager.h"
#include "../core/utils/Texture.h"


class SpriteComponent : public Component {
public:
    SpriteComponent(Object* owner);

    void SetTexture(const std::string& path);
    void SetTexture(uint64_t uaid);
    void SetNormalMap(const std::string& path);
    void SetNormalMap(uint64_t uaid);

    unsigned int GetTextureID() const;
    unsigned int GetNormalMapID() const;
    uint64_t GetTextureUAID() const;
    uint64_t GetNormalMapUAID() const;

    bool HasTexture();
    RenderType GetRenderType() const { return renderType; }
    void SetRenderType(RenderType type) { renderType = type; }

    virtual glm::vec2 GetSize() const { return size; }
    virtual std::string GetName() const override { return "SpriteComponent"; }

    virtual void Save(YAML::Emitter& out) const override;
    virtual void Load(const YAML::Node& node) override;

private:
    glm::vec2 size = { 64, 64 };
    RenderType renderType = RenderType::Lit;

    uint64_t textureUAID = 0;
    uint64_t normalMapUAID = 0;

    unsigned int textureID = 0;
    unsigned int normalMapID = 0;
    bool texture_loaded = false;
};
