// <auto-generated/>

//------------------------------------------------------------------------------------------------
//      This file has been programatically generated; DON´T EDIT!
//------------------------------------------------------------------------------------------------

#pragma warning disable SA1001
#pragma warning disable SA1027
#pragma warning disable SA1028
#pragma warning disable SA1121
#pragma warning disable SA1205
#pragma warning disable SA1309
#pragma warning disable SA1402
#pragma warning disable SA1505
#pragma warning disable SA1507
#pragma warning disable SA1508
#pragma warning disable SA1652

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Text.Json;

using JSONREADER = System.Text.Json.Utf8JsonReader;
using JSONWRITER = System.Text.Json.Utf8JsonWriter;
using FIELDINFO = SharpGLTF.Reflection.FieldInfo;


namespace SharpGLTF.Schema2
{
	using Collections;

	#if NET6_0_OR_GREATER
	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
	#endif
	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
	partial class PunctualLightSpot : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "spot";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "innerConeAngle";
			yield return "outerConeAngle";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "innerConeAngle": value = FIELDINFO.From("innerConeAngle",this, instance => instance._innerConeAngle ?? 0); return true;
				case "outerConeAngle": value = FIELDINFO.From("outerConeAngle",this, instance => instance._outerConeAngle ?? 0.7853981633974483); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const Double _innerConeAngleDefault = 0;
		private const Double _innerConeAngleMinimum = 0;
		private const Double _innerConeAngleExclusiveMaximum = 1.5707963267948966;
		private Double? _innerConeAngle = _innerConeAngleDefault;
		
		private const Double _outerConeAngleDefault = 0.7853981633974483;
		private const Double _outerConeAngleExclusiveMinimum = 0;
		private const Double _outerConeAngleMaximum = 1.5707963267948966;
		private Double? _outerConeAngle = _outerConeAngleDefault;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "innerConeAngle", _innerConeAngle, _innerConeAngleDefault);
			SerializeProperty(writer, "outerConeAngle", _outerConeAngle, _outerConeAngleDefault);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "innerConeAngle": DeserializePropertyValue<PunctualLightSpot, Double?>(ref reader, this, out _innerConeAngle); break;
				case "outerConeAngle": DeserializePropertyValue<PunctualLightSpot, Double?>(ref reader, this, out _outerConeAngle); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

	/// <summary>
	/// A directional, point, or spot light.
	/// </summary>
	#if NET6_0_OR_GREATER
	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
	#endif
	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
	partial class PunctualLight : LogicalChildOfRoot
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "light";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "color";
			yield return "intensity";
			yield return "range";
			yield return "spot";
			yield return "type";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "color": value = FIELDINFO.From("color",this, instance => instance._color ?? Vector3.One); return true;
				case "intensity": value = FIELDINFO.From("intensity",this, instance => instance._intensity ?? 1); return true;
				case "range": value = FIELDINFO.From("range",this, instance => instance._range); return true;
				case "spot": value = FIELDINFO.From("spot",this, instance => instance._spot); return true;
				case "type": value = FIELDINFO.From("type",this, instance => instance._type); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private static readonly Vector3 _colorDefault = Vector3.One;
		private Vector3? _color = _colorDefault;
		
		private const Double _intensityDefault = 1;
		private const Double _intensityMinimum = 0;
		private Double? _intensity = _intensityDefault;
		
		private const Double _rangeExclusiveMinimum = 0;
		private Double? _range;
		
		private PunctualLightSpot _spot;
		
		private String _type;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "color", _color, _colorDefault);
			SerializeProperty(writer, "intensity", _intensity, _intensityDefault);
			SerializeProperty(writer, "range", _range);
			SerializePropertyObject(writer, "spot", _spot);
			SerializeProperty(writer, "type", _type);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "color": DeserializePropertyValue<PunctualLight, Vector3?>(ref reader, this, out _color); break;
				case "intensity": DeserializePropertyValue<PunctualLight, Double?>(ref reader, this, out _intensity); break;
				case "range": DeserializePropertyValue<PunctualLight, Double?>(ref reader, this, out _range); break;
				case "spot": DeserializePropertyValue<PunctualLight, PunctualLightSpot>(ref reader, this, out _spot); break;
				case "type": DeserializePropertyValue<PunctualLight, String>(ref reader, this, out _type); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

	#if NET6_0_OR_GREATER
	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
	#endif
	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
	partial class _ModelPunctualLights : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_lights_punctual";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "lights";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "lights": value = FIELDINFO.From("lights",this, instance => instance._lights); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const int _lightsMinItems = 1;
		private ChildrenList<PunctualLight,ModelRoot> _lights;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "lights", _lights, _lightsMinItems);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "lights": DeserializePropertyList<_ModelPunctualLights, PunctualLight>(ref reader, this, _lights); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
