#pragma once

#include <wx/dataview.h>
#include <RumPi/Components/BaseComponent.h>

/**
* View-model for a single component tile on the dashboard: its icon, type, name, current data string, and enabled
* state.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*/
class ComponentData
{
protected:
	wxBitmapBundle myIcon;					///< The component's icon (derived from its type).
	RumPi::EComponentType myComponentType;	///< The component's type.
	wxString myName;						///< The component's unique instance name, shown as its label.
	wxString myData;						///< The current data string to display.
	bool myIsEnabled;						///< Whether the component is currently enabled.

public:
	/**
	* Builds an empty component tile with an unknown type and disabled state.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	ComponentData data;
	* @endcode
	*/
	ComponentData();

	/**
	* Builds a component tile from its type (which selects the icon), name, initial data string, and enabled state.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	ComponentData data(RumPi::EComponentType::E_LED, "Porch LED", "On", true);
	* @endcode
	*
	* @param [in] componentType The component type; its icon is derived from this.
	* @param [in] name          The component's unique instance name, shown as its label.
	* @param [in] data          The initial data string to display.
	* @param [in] isEnabled     Whether the component is currently enabled.
	*/
	ComponentData(const RumPi::EComponentType componentType, const wxString& name, const wxString& data, const bool isEnabled);

	/**
	* Defaulted destructor.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	ComponentData* data = new ComponentData();
	*	delete data;
	* @endcode
	*/
	virtual ~ComponentData() = default;

	/**
	* Gets the component's icon.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	wxBitmapBundle icon = data.GetIcon();
	* @endcode
	*
	* @return The component's icon.
	*/
	wxBitmapBundle GetIcon() const;

	/**
	* Gets the component's type.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	RumPi::EComponentType type = data.GetComponentType();
	* @endcode
	*
	* @return The component's type.
	*/
	RumPi::EComponentType GetComponentType() const;

	/**
	* Gets the component's unique instance name.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	wxString name = data.GetName();
	* @endcode
	*
	* @return The component's name.
	*/
	const wxString& GetName() const;

	/**
	* Gets the component's current data string.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	wxString value = data.GetData();
	* @endcode
	*
	* @return The component's data string.
	*/
	const wxString& GetData() const;

	/**
	* Gets whether the component is currently enabled.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	bool enabled = data.GetIsEnabled();
	* @endcode
	*
	* @return True if the component is enabled.
	*/
	bool GetIsEnabled() const;

	/**
	* Sets the component's icon.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	data.SetIcon(icon);
	* @endcode
	*
	* @param [in] icon The icon to set.
	*/
	void SetIcon(const wxBitmapBundle& icon);

	/**
	* Sets the component's type.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	data.SetComponentType(RumPi::EComponentType::E_LED);
	* @endcode
	*
	* @param [in] componentType The component type to set.
	*/
	void SetComponentType(const RumPi::EComponentType componentType);

	/**
	* Sets the component's unique instance name.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	data.SetName("Porch LED");
	* @endcode
	*
	* @param [in] name The name to set.
	*/
	void SetName(const wxString& name);

	/**
	* Sets the component's current data string.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	data.SetData("On");
	* @endcode
	*
	* @param [in] data The data string to set.
	*/
	void SetData(const wxString& data);

	/**
	* Sets whether the component is currently enabled.
	*
	* @author Eddie O'Hagan
	* @date 8/13/2026
	*
	* @code
	*	data.SetIsEnabled(true);
	* @endcode
	*
	* @param [in] isEnabled True if the component is enabled.
	*/
	void SetIsEnabled(const bool isEnabled);
};
