#pragma once

#include "ehs/EHS.h"
#include "ehs/Str.h"

namespace ehs
{
	class JsonBase;
	class JsonObj;
	class JsonArray;
	class JsonBool;
	class JsonNum;
	class JsonStr;

	class EHS_LIB_IO JsonVar final
	{
	private:
		UInt_64 hashId;
		Str_8 id;
		JsonBase* value;

	public:
		~JsonVar();

		JsonVar();

		JsonVar(Str_8 id);

		JsonVar(Str_8 id, const JsonBase *value);

		JsonVar(Str_8 id, const JsonBase &value);

		JsonVar(Str_8 id, const JsonObj &value);

		JsonVar(Str_8 id, const JsonArray &value);

		JsonVar(Str_8 id, const JsonBool &value);

		JsonVar(Str_8 id, bool boolean);

		JsonVar(Str_8 id, const JsonNum &value);

		JsonVar(Str_8 id, SInt_64 num);

		JsonVar(Str_8 id, UInt_64 num);

		JsonVar(Str_8 id, SInt_32 num);

		JsonVar(Str_8 id, UInt_32 num);

		JsonVar(Str_8 id, SInt_16 num);

		JsonVar(Str_8 id, UInt_16 num);

		JsonVar(Str_8 id, SInt_8 num);

		JsonVar(Str_8 id, UInt_8 num);

		JsonVar(Str_8 id, double num);

		JsonVar(Str_8 id, float num);

		JsonVar(Str_8 id, const JsonStr &value);

		JsonVar(Str_8 id, const Char_8 *str, UInt_64 size = 0);

		JsonVar(Str_8 id, Str_8 str);

		JsonVar(JsonVar&& var) noexcept;

		JsonVar(const JsonVar& var);

		JsonVar& operator=(JsonVar&& var) noexcept;

		JsonVar& operator=(const JsonVar& var);

		UInt_64 GetHashId() const;

		Str_8 GetId() const;

		void SetValue(const JsonBase *newValue);

		void SetValue(const JsonBase &newValue);

		void SetValue(const JsonObj &newValue);

		void SetValue(const JsonArray &newValue);

		void SetValue(const JsonBool &newValue);

		void SetValue(bool newValue);

		void SetValue(const JsonNum& newValue);

		void SetValue(float newValue);

		void SetValue(const JsonStr& newValue);

		void SetValue(const Char_8* newValue, UInt_64 size = 0);

		void SetValue(const Str_8& newValue);

		const JsonBase* GetValue() const;

		JsonBase* GetValue();

		Str_8 ToStr(UInt_64 level, bool compact) const;
	};
}