#pragma once

#include "../Interfaces/IParameter.h"
#include "../Interfaces/IPlugin.h"


class k_BaseParameter
	: public IParameter
{
public:
	k_BaseParameter(IDirect3D9BasePlugin& ar_Plugin, const GUID& ar_Guid, const std::wstring& as_Name, const std::wstring& as_DisplayText, const std::wstring& as_Description, r_ParameterType::Enumeration ae_Type)
		: mr_Plugin(ar_Plugin)
		, ms_Name(as_Name)
		, ms_Description(as_Description)
		, me_Type(ae_Type)
		, ms_DisplayText(as_DisplayText)
		, ms_RawDisplayText(as_DisplayText)
		, mr_Guid(ar_Guid)
	{
	}

	// IObject
	void* QueryInterface(const GUID& ar_InterfaceGuid)
	{
		if (ar_InterfaceGuid == __uuidof(IParameter)) 
			return static_cast<IParameter*>(this);

		return NULL; 
	}

	// IParameter
	virtual r_ParameterType::Enumeration get_ParameterType() const
	{
		return me_Type;
	}

	virtual std::wstring get_Name() const
	{
		return ms_Name;
	}

	virtual std::wstring get_Description() const
	{
		return ms_Description;
	}

	virtual void set_DisplayText(const std::wstring& as_Text)
	{
		ms_DisplayText = as_Text;
	}

	virtual std::wstring get_DisplayText() const
	{
		return ms_DisplayText;
	}

	virtual void ResetToDefault() = 0;

	virtual GUID get_Id() const
	{
		return mr_Guid;
	}

	virtual std::wstring ToString() = 0;
	virtual void FromString(const std::wstring& as_Value) = 0;

	virtual IDirect3D9BasePlugin* get_Owner() const
	{
		return &mr_Plugin;
	}

protected:
	IDirect3D9BasePlugin& mr_Plugin;
	std::wstring ms_Name;
	std::wstring ms_Description;
	std::wstring ms_DisplayText;
	std::wstring ms_RawDisplayText;
	r_ParameterType::Enumeration me_Type;
	GUID mr_Guid;
};
