#pragma warning disable CS0162
using System;
using System.Linq;
using System.Collections.Generic;
using Ingvar.LiveWatch;
using Object = UnityEngine.Object;

namespace Ingvar.LiveWatch
{
	// It's completely generated class, avoid modifying!
	public static partial class Watch
	{
		private static string _tempStr;
		private static HashSet<string> _tempStrSet = new();
		private static Dictionary<object, HashSet<string>> _tempSetDict = new();
		private static WatchReferenceCreator RC = WatchServices.ReferenceCreator;
		private static WatchCachedNamesBuilder NB = WatchServices.NameBuilder;

		#region Double

		public static WatchReference<Double> GetOrAdd(string path, Func<Double> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Double>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Double>();
#endif
		}

		public static WatchReference<Double> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Double> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Double, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Double>();
#endif
		}

		public static WatchReference<Double> Setup(WatchReference<Double> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Double);
#endif
			return wr;
		}

		public static WatchReference<Double> Push(WatchReference<Double> wr, Double value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushDouble(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Double> Push(string path, Double value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Double>(path), value, depth);
		}

		#endregion

		#region Single

		public static WatchReference<Single> GetOrAdd(string path, Func<Single> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Single>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Single>();
#endif
		}

		public static WatchReference<Single> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Single> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Single, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Single>();
#endif
		}

		public static WatchReference<Single> Setup(WatchReference<Single> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Float);
#endif
			return wr;
		}

		public static WatchReference<Single> Push(WatchReference<Single> wr, Single value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushFloat(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Single> Push(string path, Single value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Single>(path), value, depth);
		}

		#endregion

		#region Int32

		public static WatchReference<Int32> GetOrAdd(string path, Func<Int32> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int32>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int32>();
#endif
		}

		public static WatchReference<Int32> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Int32> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int32, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int32>();
#endif
		}

		public static WatchReference<Int32> Setup(WatchReference<Int32> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Int);
#endif
			return wr;
		}

		public static WatchReference<Int32> Push(WatchReference<Int32> wr, Int32 value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushInt(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Int32> Push(string path, Int32 value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Int32>(path), value, depth);
		}

		#endregion

		#region String

		public static WatchReference<String> GetOrAdd(string path, Func<String> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<String>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<String>();
#endif
		}

		public static WatchReference<String> GetOrAdd<T>(WatchReference<T> parent, string path, Func<String> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<String, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<String>();
#endif
		}

		public static WatchReference<String> Setup(WatchReference<String> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.String);
#endif
			return wr;
		}

		public static WatchReference<String> Push(WatchReference<String> wr, String value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			if (value == null)
				return RC.PushNull(wr, depth - 1);

			RC.PushString(wr, value);
#endif
			return wr;
		}

		public static WatchReference<String> Push(string path, String value, int depth = 10)
		{
			return Push(RC.GetOrAdd<String>(path), value, depth);
		}

		#endregion

		#region Boolean

		public static WatchReference<Boolean> GetOrAdd(string path, Func<Boolean> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Boolean>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Boolean>();
#endif
		}

		public static WatchReference<Boolean> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Boolean> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Boolean, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Boolean>();
#endif
		}

		public static WatchReference<Boolean> Setup(WatchReference<Boolean> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Bool);
#endif
			return wr;
		}

		public static WatchReference<Boolean> Push(WatchReference<Boolean> wr, Boolean value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushBool(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Boolean> Push(string path, Boolean value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Boolean>(path), value, depth);
		}

		#endregion

		#region Decimal

		public static WatchReference<Decimal> GetOrAdd(string path, Func<Decimal> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Decimal>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Decimal>();
#endif
		}

		public static WatchReference<Decimal> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Decimal> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Decimal, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Decimal>();
#endif
		}

		public static WatchReference<Decimal> Setup(WatchReference<Decimal> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Double);
#endif
			return wr;
		}

		public static WatchReference<Decimal> Push(WatchReference<Decimal> wr, Decimal value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushDecimal(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Decimal> Push(string path, Decimal value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Decimal>(path), value, depth);
		}

		#endregion

		#region Int64

		public static WatchReference<Int64> GetOrAdd(string path, Func<Int64> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int64>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int64>();
#endif
		}

		public static WatchReference<Int64> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Int64> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int64, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int64>();
#endif
		}

		public static WatchReference<Int64> Setup(WatchReference<Int64> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Double);
#endif
			return wr;
		}

		public static WatchReference<Int64> Push(WatchReference<Int64> wr, Int64 value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushLong(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Int64> Push(string path, Int64 value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Int64>(path), value, depth);
		}

		#endregion

		#region Int16

		public static WatchReference<Int16> GetOrAdd(string path, Func<Int16> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int16>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int16>();
#endif
		}

		public static WatchReference<Int16> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Int16> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Int16, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Int16>();
#endif
		}

		public static WatchReference<Int16> Setup(WatchReference<Int16> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Int);
#endif
			return wr;
		}

		public static WatchReference<Int16> Push(WatchReference<Int16> wr, Int16 value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushShort(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Int16> Push(string path, Int16 value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Int16>(path), value, depth);
		}

		#endregion

		#region Byte

		public static WatchReference<Byte> GetOrAdd(string path, Func<Byte> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Byte>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Byte>();
#endif
		}

		public static WatchReference<Byte> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Byte> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Byte, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Byte>();
#endif
		}

		public static WatchReference<Byte> Setup(WatchReference<Byte> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Int);
#endif
			return wr;
		}

		public static WatchReference<Byte> Push(WatchReference<Byte> wr, Byte value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushByte(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Byte> Push(string path, Byte value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Byte>(path), value, depth);
		}

		#endregion

		#region UInt64

		public static WatchReference<UInt64> GetOrAdd(string path, Func<UInt64> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<UInt64>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<UInt64>();
#endif
		}

		public static WatchReference<UInt64> GetOrAdd<T>(WatchReference<T> parent, string path, Func<UInt64> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<UInt64, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<UInt64>();
#endif
		}

		public static WatchReference<UInt64> Setup(WatchReference<UInt64> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Double);
#endif
			return wr;
		}

		public static WatchReference<UInt64> Push(WatchReference<UInt64> wr, UInt64 value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushULong(wr, value);
#endif
			return wr;
		}

		public static WatchReference<UInt64> Push(string path, UInt64 value, int depth = 10)
		{
			return Push(RC.GetOrAdd<UInt64>(path), value, depth);
		}

		#endregion

		#region UInt16

		public static WatchReference<UInt16> GetOrAdd(string path, Func<UInt16> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<UInt16>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<UInt16>();
#endif
		}

		public static WatchReference<UInt16> GetOrAdd<T>(WatchReference<T> parent, string path, Func<UInt16> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<UInt16, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<UInt16>();
#endif
		}

		public static WatchReference<UInt16> Setup(WatchReference<UInt16> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Int);
#endif
			return wr;
		}

		public static WatchReference<UInt16> Push(WatchReference<UInt16> wr, UInt16 value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushUShort(wr, value);
#endif
			return wr;
		}

		public static WatchReference<UInt16> Push(string path, UInt16 value, int depth = 10)
		{
			return Push(RC.GetOrAdd<UInt16>(path), value, depth);
		}

		#endregion

		#region SByte

		public static WatchReference<SByte> GetOrAdd(string path, Func<SByte> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<SByte>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<SByte>();
#endif
		}

		public static WatchReference<SByte> GetOrAdd<T>(WatchReference<T> parent, string path, Func<SByte> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<SByte, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<SByte>();
#endif
		}

		public static WatchReference<SByte> Setup(WatchReference<SByte> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.Int);
#endif
			return wr;
		}

		public static WatchReference<SByte> Push(WatchReference<SByte> wr, SByte value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushSByte(wr, value);
#endif
			return wr;
		}

		public static WatchReference<SByte> Push(string path, SByte value, int depth = 10)
		{
			return Push(RC.GetOrAdd<SByte>(path), value, depth);
		}

		#endregion

		#region Char

		public static WatchReference<Char> GetOrAdd(string path, Func<Char> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Char>(path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Char>();
#endif
		}

		public static WatchReference<Char> GetOrAdd<T>(WatchReference<T> parent, string path, Func<Char> valueGetter)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			var wr = Setup(RC.GetOrAdd<Char, T>(parent, path));

			RC.SetUpdateCall(wr, () =>
			{
				var value = valueGetter();
				Push(wr, value);
			});

			return wr;
#else
			return RC.Empty<Char>();
#endif
		}

		public static WatchReference<Char> Setup(WatchReference<Char> wr)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			return RC.TrySetupAs(wr, WatchValueType.String);
#endif
			return wr;
		}

		public static WatchReference<Char> Push(WatchReference<Char> wr, Char value, int depth = 10)
		{
#if UNITY_EDITOR || LIVE_WATCH_BUILD
			if (depth <= 0 || !Watch.IsLive || RC.IsInvalidType(wr))
				return wr;

			Setup(wr);
			RC.PushChar(wr, value);
#endif
			return wr;
		}

		public static WatchReference<Char> Push(string path, Char value, int depth = 10)
		{
			return Push(RC.GetOrAdd<Char>(path), value, depth);
		}

		#endregion
	}
}