// <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 clearcoat material layer.
	/// </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 MaterialClearCoat : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_materials_clearcoat";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "clearcoatFactor";
			yield return "clearcoatNormalTexture";
			yield return "clearcoatRoughnessFactor";
			yield return "clearcoatRoughnessTexture";
			yield return "clearcoatTexture";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "clearcoatFactor": value = FIELDINFO.From("clearcoatFactor",this, instance => instance._clearcoatFactor ?? 0); return true;
				case "clearcoatNormalTexture": value = FIELDINFO.From("clearcoatNormalTexture",this, instance => instance._clearcoatNormalTexture); return true;
				case "clearcoatRoughnessFactor": value = FIELDINFO.From("clearcoatRoughnessFactor",this, instance => instance._clearcoatRoughnessFactor ?? 0); return true;
				case "clearcoatRoughnessTexture": value = FIELDINFO.From("clearcoatRoughnessTexture",this, instance => instance._clearcoatRoughnessTexture); return true;
				case "clearcoatTexture": value = FIELDINFO.From("clearcoatTexture",this, instance => instance._clearcoatTexture); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const Double _clearcoatFactorDefault = 0;
		private const Double _clearcoatFactorMinimum = 0;
		private const Double _clearcoatFactorMaximum = 1;
		private Double? _clearcoatFactor = _clearcoatFactorDefault;
		
		private MaterialNormalTextureInfo _clearcoatNormalTexture;
		
		private const Double _clearcoatRoughnessFactorDefault = 0;
		private const Double _clearcoatRoughnessFactorMinimum = 0;
		private const Double _clearcoatRoughnessFactorMaximum = 1;
		private Double? _clearcoatRoughnessFactor = _clearcoatRoughnessFactorDefault;
		
		private TextureInfo _clearcoatRoughnessTexture;
		
		private TextureInfo _clearcoatTexture;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "clearcoatFactor", _clearcoatFactor, _clearcoatFactorDefault);
			SerializePropertyObject(writer, "clearcoatNormalTexture", _clearcoatNormalTexture);
			SerializeProperty(writer, "clearcoatRoughnessFactor", _clearcoatRoughnessFactor, _clearcoatRoughnessFactorDefault);
			SerializePropertyObject(writer, "clearcoatRoughnessTexture", _clearcoatRoughnessTexture);
			SerializePropertyObject(writer, "clearcoatTexture", _clearcoatTexture);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "clearcoatFactor": DeserializePropertyValue<MaterialClearCoat, Double?>(ref reader, this, out _clearcoatFactor); break;
				case "clearcoatNormalTexture": DeserializePropertyValue<MaterialClearCoat, MaterialNormalTextureInfo>(ref reader, this, out _clearcoatNormalTexture); break;
				case "clearcoatRoughnessFactor": DeserializePropertyValue<MaterialClearCoat, Double?>(ref reader, this, out _clearcoatRoughnessFactor); break;
				case "clearcoatRoughnessTexture": DeserializePropertyValue<MaterialClearCoat, TextureInfo>(ref reader, this, out _clearcoatRoughnessTexture); break;
				case "clearcoatTexture": DeserializePropertyValue<MaterialClearCoat, TextureInfo>(ref reader, this, out _clearcoatTexture); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
