#ifndef EDITSCENE_TRANSFORM_HPP
#define EDITSCENE_TRANSFORM_HPP
#pragma once
#include <Ogre.h>

/**
 * Transform component for Flecs entities
 * Links a Flecs entity to an Ogre SceneNode
 */
struct TransformComponent {
	Ogre::SceneNode *node = nullptr;
	Ogre::Vector3 position = Ogre::Vector3::ZERO;
	Ogre::Quaternion rotation = Ogre::Quaternion::IDENTITY;
	Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE;
	
	// Version tracking for change detection
	unsigned int version = 0;

	/**
	 * Apply component values to the scene node
	 */
	void applyToNode() const
	{
		if (node) {
			node->setPosition(position);
			node->setOrientation(rotation);
			node->setScale(scale);
		}
	}

	/**
	 * Update component values from the scene node
	 */
	void updateFromNode()
	{
		if (node) {
			position = node->getPosition();
			rotation = node->getOrientation();
			scale = node->getScale();
		}
	}
	
	/**
	 * Mark transform as changed (increment version)
	 */
	void markChanged() { version++; }
};

#endif // EDITSCENE_TRANSFORM_HPP
