// <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 the strength of the specular reflection.
	/// </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 MaterialSpecular : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_materials_specular";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "specularColorFactor";
			yield return "specularColorTexture";
			yield return "specularFactor";
			yield return "specularTexture";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "specularColorFactor": value = FIELDINFO.From("specularColorFactor",this, instance => instance._specularColorFactor ?? Vector3.One); return true;
				case "specularColorTexture": value = FIELDINFO.From("specularColorTexture",this, instance => instance._specularColorTexture); return true;
				case "specularFactor": value = FIELDINFO.From("specularFactor",this, instance => instance._specularFactor ?? 1); return true;
				case "specularTexture": value = FIELDINFO.From("specularTexture",this, instance => instance._specularTexture); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private static readonly Vector3 _specularColorFactorDefault = Vector3.One;
		private Vector3? _specularColorFactor = _specularColorFactorDefault;
		
		private TextureInfo _specularColorTexture;
		
		private const Double _specularFactorDefault = 1;
		private const Double _specularFactorMinimum = 0;
		private const Double _specularFactorMaximum = 1;
		private Double? _specularFactor = _specularFactorDefault;
		
		private TextureInfo _specularTexture;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "specularColorFactor", _specularColorFactor, _specularColorFactorDefault);
			SerializePropertyObject(writer, "specularColorTexture", _specularColorTexture);
			SerializeProperty(writer, "specularFactor", _specularFactor, _specularFactorDefault);
			SerializePropertyObject(writer, "specularTexture", _specularTexture);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "specularColorFactor": DeserializePropertyValue<MaterialSpecular, Vector3?>(ref reader, this, out _specularColorFactor); break;
				case "specularColorTexture": DeserializePropertyValue<MaterialSpecular, TextureInfo>(ref reader, this, out _specularColorTexture); break;
				case "specularFactor": DeserializePropertyValue<MaterialSpecular, Double?>(ref reader, this, out _specularFactor); break;
				case "specularTexture": DeserializePropertyValue<MaterialSpecular, TextureInfo>(ref reader, this, out _specularTexture); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
