// <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 diffuse transmission of the material.
	/// </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 MaterialDiffuseTransmission : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_materials_diffuse_transmission";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "diffuseTransmissionColorFactor";
			yield return "diffuseTransmissionColorTexture";
			yield return "diffuseTransmissionFactor";
			yield return "diffuseTransmissionTexture";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "diffuseTransmissionColorFactor": value = FIELDINFO.From("diffuseTransmissionColorFactor",this, instance => instance._diffuseTransmissionColorFactor ?? Vector3.One); return true;
				case "diffuseTransmissionColorTexture": value = FIELDINFO.From("diffuseTransmissionColorTexture",this, instance => instance._diffuseTransmissionColorTexture); return true;
				case "diffuseTransmissionFactor": value = FIELDINFO.From("diffuseTransmissionFactor",this, instance => instance._diffuseTransmissionFactor ?? 0); return true;
				case "diffuseTransmissionTexture": value = FIELDINFO.From("diffuseTransmissionTexture",this, instance => instance._diffuseTransmissionTexture); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private static readonly Vector3 _diffuseTransmissionColorFactorDefault = Vector3.One;
		private Vector3? _diffuseTransmissionColorFactor = _diffuseTransmissionColorFactorDefault;
		
		private TextureInfo _diffuseTransmissionColorTexture;
		
		private const Double _diffuseTransmissionFactorDefault = 0;
		private const Double _diffuseTransmissionFactorMinimum = 0;
		private const Double _diffuseTransmissionFactorMaximum = 1;
		private Double? _diffuseTransmissionFactor = _diffuseTransmissionFactorDefault;
		
		private TextureInfo _diffuseTransmissionTexture;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "diffuseTransmissionColorFactor", _diffuseTransmissionColorFactor, _diffuseTransmissionColorFactorDefault);
			SerializePropertyObject(writer, "diffuseTransmissionColorTexture", _diffuseTransmissionColorTexture);
			SerializeProperty(writer, "diffuseTransmissionFactor", _diffuseTransmissionFactor, _diffuseTransmissionFactorDefault);
			SerializePropertyObject(writer, "diffuseTransmissionTexture", _diffuseTransmissionTexture);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "diffuseTransmissionColorFactor": DeserializePropertyValue<MaterialDiffuseTransmission, Vector3?>(ref reader, this, out _diffuseTransmissionColorFactor); break;
				case "diffuseTransmissionColorTexture": DeserializePropertyValue<MaterialDiffuseTransmission, TextureInfo>(ref reader, this, out _diffuseTransmissionColorTexture); break;
				case "diffuseTransmissionFactor": DeserializePropertyValue<MaterialDiffuseTransmission, Double?>(ref reader, this, out _diffuseTransmissionFactor); break;
				case "diffuseTransmissionTexture": DeserializePropertyValue<MaterialDiffuseTransmission, TextureInfo>(ref reader, this, out _diffuseTransmissionTexture); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
