// <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;

	/// <summary>
	/// glTF extension that defines an iridescence effect.
	/// </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 MaterialIridescence : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_materials_iridescence";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "iridescenceFactor";
			yield return "iridescenceIor";
			yield return "iridescenceTexture";
			yield return "iridescenceThicknessMaximum";
			yield return "iridescenceThicknessMinimum";
			yield return "iridescenceThicknessTexture";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "iridescenceFactor": value = FIELDINFO.From("iridescenceFactor",this, instance => instance._iridescenceFactor ?? 0); return true;
				case "iridescenceIor": value = FIELDINFO.From("iridescenceIor",this, instance => instance._iridescenceIor ?? 1.3); return true;
				case "iridescenceTexture": value = FIELDINFO.From("iridescenceTexture",this, instance => instance._iridescenceTexture); return true;
				case "iridescenceThicknessMaximum": value = FIELDINFO.From("iridescenceThicknessMaximum",this, instance => instance._iridescenceThicknessMaximum ?? 400); return true;
				case "iridescenceThicknessMinimum": value = FIELDINFO.From("iridescenceThicknessMinimum",this, instance => instance._iridescenceThicknessMinimum ?? 100); return true;
				case "iridescenceThicknessTexture": value = FIELDINFO.From("iridescenceThicknessTexture",this, instance => instance._iridescenceThicknessTexture); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const Double _iridescenceFactorDefault = 0;
		private const Double _iridescenceFactorMinimum = 0;
		private const Double _iridescenceFactorMaximum = 1;
		private Double? _iridescenceFactor = _iridescenceFactorDefault;
		
		private const Double _iridescenceIorDefault = 1.3;
		private const Double _iridescenceIorMinimum = 1;
		private Double? _iridescenceIor = _iridescenceIorDefault;
		
		private TextureInfo _iridescenceTexture;
		
		private const Double _iridescenceThicknessMaximumDefault = 400;
		private const Double _iridescenceThicknessMaximumMinimum = 0;
		private Double? _iridescenceThicknessMaximum = _iridescenceThicknessMaximumDefault;
		
		private const Double _iridescenceThicknessMinimumDefault = 100;
		private const Double _iridescenceThicknessMinimumMinimum = 0;
		private Double? _iridescenceThicknessMinimum = _iridescenceThicknessMinimumDefault;
		
		private TextureInfo _iridescenceThicknessTexture;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "iridescenceFactor", _iridescenceFactor, _iridescenceFactorDefault);
			SerializeProperty(writer, "iridescenceIor", _iridescenceIor, _iridescenceIorDefault);
			SerializePropertyObject(writer, "iridescenceTexture", _iridescenceTexture);
			SerializeProperty(writer, "iridescenceThicknessMaximum", _iridescenceThicknessMaximum, _iridescenceThicknessMaximumDefault);
			SerializeProperty(writer, "iridescenceThicknessMinimum", _iridescenceThicknessMinimum, _iridescenceThicknessMinimumDefault);
			SerializePropertyObject(writer, "iridescenceThicknessTexture", _iridescenceThicknessTexture);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "iridescenceFactor": DeserializePropertyValue<MaterialIridescence, Double?>(ref reader, this, out _iridescenceFactor); break;
				case "iridescenceIor": DeserializePropertyValue<MaterialIridescence, Double?>(ref reader, this, out _iridescenceIor); break;
				case "iridescenceTexture": DeserializePropertyValue<MaterialIridescence, TextureInfo>(ref reader, this, out _iridescenceTexture); break;
				case "iridescenceThicknessMaximum": DeserializePropertyValue<MaterialIridescence, Double?>(ref reader, this, out _iridescenceThicknessMaximum); break;
				case "iridescenceThicknessMinimum": DeserializePropertyValue<MaterialIridescence, Double?>(ref reader, this, out _iridescenceThicknessMinimum); break;
				case "iridescenceThicknessTexture": DeserializePropertyValue<MaterialIridescence, TextureInfo>(ref reader, this, out _iridescenceThicknessTexture); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
