#include "../../Headers/GUI/LoggerLineData.h"
#include <RumPi/AlertManager.h>

/**
* Creates an empty log line, defaulted to the OK level.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	LoggerLineData line;
* @endcode
*/
LoggerLineData::LoggerLineData()
{
	myLogTime = "";
	myAlertLevel = RumPi::EAlertLevel::OK;
	myEventDescription = "";
}

/**
* Creates a log line from a formatted timestamp, an alert level, and a description.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	LoggerLineData line("2026-07-12 15:31:41", RumPi::EAlertLevel::Warning, "Low memory.");
* @endcode
*
* @param [in] logTime          The formatted timestamp (e.g. "2026-07-12 15:31:41").
* @param [in] alertLevel       The severity of the event.
* @param [in] eventDescription The human-readable event summary.
*/
LoggerLineData::LoggerLineData(const wxString& logTime, const RumPi::EAlertLevel alertLevel, const wxString& eventDescription)
{
	myLogTime = logTime;
	myAlertLevel = alertLevel;
	myEventDescription = eventDescription;
}

/**
* Gets the formatted timestamp of the log entry.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	wxString time = line.GetLogTime();
* @endcode
*
* @return The formatted timestamp.
*/
const wxString& LoggerLineData::GetLogTime() const
{
	return myLogTime;
}

/**
* Gets the severity of the logged event.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	RumPi::EAlertLevel level = line.GetAlertLevel();
* @endcode
*
* @return The alert level.
*/
RumPi::EAlertLevel LoggerLineData::GetAlertLevel() const
{
	return myAlertLevel;
}

/**
* Gets the alert level formatted as text for display (e.g. "Warning").
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	wxString text = line.GetAlertLevelText();
* @endcode
*
* @return The alert level as a display string.
*/
wxString LoggerLineData::GetAlertLevelText() const
{
	//Reuse the library's formatter so the window and the file log agree on the wording.
	return RumPi::AlertManager::LevelToString(myAlertLevel);
}

/**
* Gets the human-readable event summary.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	wxString description = line.GetEventDescription();
* @endcode
*
* @return The event description.
*/
const wxString& LoggerLineData::GetEventDescription() const
{
	return myEventDescription;
}

/**
* Sets the formatted timestamp of the log entry.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	line.SetLogTime("2026-07-12 15:31:41");
* @endcode
*
* @param [in] logTime The formatted timestamp to set.
*/
void LoggerLineData::SetLogTime(const wxString& logTime)
{
	myLogTime = logTime;
}

/**
* Sets the severity of the logged event.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	line.SetAlertLevel(RumPi::EAlertLevel::Alert);
* @endcode
*
* @param [in] alertLevel The alert level to set.
*/
void LoggerLineData::SetAlertLevel(const RumPi::EAlertLevel alertLevel)
{
	myAlertLevel = alertLevel;
}

/**
* Sets the human-readable event summary.
*
* @author Eddie O'Hagan
* @date 8/13/2026
*
* @code
*	line.SetEventDescription("Low memory.");
* @endcode
*
* @param [in] eventDescription The event description to set.
*/
void LoggerLineData::SetEventDescription(const wxString& eventDescription)
{
	myEventDescription = eventDescription;
}
