#ifndef EDITSCENE_SUN_HPP
#define EDITSCENE_SUN_HPP
#pragma once

#include <Ogre.h>

/**
 * Sun component - manages a directional light that rotates
 * based on in-game time, with sun/moon visualization.
 *
 * Designed to work alongside SkyboxComponent on the same entity.
 */
struct SunComponent {
	// Enable/disable sun system
	bool enabled = true;

	// Time of day in hours (0.0 - 24.0)
	float timeOfDay = 12.0f;

	// Game time speed: game-hours per real-second
	// 0.01 = 1 game hour per 100 real seconds (slow)
	// 0.1  = 1 game hour per 10 real seconds
	// 1.0  = 1 game hour per 1 real second (fast)
	float timeSpeed = 0.05f;

	// Sun color when at zenith (day)
	Ogre::ColourValue sunColor = Ogre::ColourValue(1.0f, 0.95f, 0.8f);

	// Moon color when sun is below horizon (night)
	Ogre::ColourValue moonColor = Ogre::ColourValue(0.3f, 0.3f, 0.5f);

	// Ambient light colors
	Ogre::ColourValue ambientDay = Ogre::ColourValue(0.3f, 0.3f, 0.3f);
	Ogre::ColourValue ambientNight = Ogre::ColourValue(0.05f, 0.05f, 0.15f);
	Ogre::ColourValue ambientSunrise = Ogre::ColourValue(0.3f, 0.2f, 0.15f);
	Ogre::ColourValue ambientSunset = Ogre::ColourValue(0.25f, 0.15f, 0.1f);

	// Sun / moon visualization spheres
	bool showSunSphere = true;
	bool showMoonSphere = true;
	float sunSphereSize = 5.0f;
	float moonSphereSize = 3.0f;

	// Orbit tilt (degrees) - tilts the sun path north/south
	float orbitTilt = 15.0f;

	// Light intensity multiplier
	float intensity = 1.0f;

	// Cast shadows
	bool castShadows = true;

	// Runtime objects (managed by EditorSunSystem)
	Ogre::Light *light = nullptr;
	Ogre::SceneNode *lightNode = nullptr;
	Ogre::SceneNode *sunSphereNode = nullptr;
	Ogre::SceneNode *moonSphereNode = nullptr;
	Ogre::ManualObject *sunSphere = nullptr;
	Ogre::ManualObject *moonSphere = nullptr;

	// Dirty flag - triggers rebuild
	bool dirty = true;

	void markDirty()
	{
		dirty = true;
	}
};

#endif // EDITSCENE_SUN_HPP
