// <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 anisotropy.
	/// </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 MaterialAnisotropy : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "KHR_materials_anisotropy";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "anisotropyRotation";
			yield return "anisotropyStrength";
			yield return "anisotropyTexture";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "anisotropyRotation": value = FIELDINFO.From("anisotropyRotation",this, instance => instance._anisotropyRotation ?? 0); return true;
				case "anisotropyStrength": value = FIELDINFO.From("anisotropyStrength",this, instance => instance._anisotropyStrength ?? 0); return true;
				case "anisotropyTexture": value = FIELDINFO.From("anisotropyTexture",this, instance => instance._anisotropyTexture); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const Double _anisotropyRotationDefault = 0;
		private Double? _anisotropyRotation = _anisotropyRotationDefault;
		
		private const Double _anisotropyStrengthDefault = 0;
		private const Double _anisotropyStrengthMinimum = 0;
		private const Double _anisotropyStrengthMaximum = 1;
		private Double? _anisotropyStrength = _anisotropyStrengthDefault;
		
		private TextureInfo _anisotropyTexture;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "anisotropyRotation", _anisotropyRotation, _anisotropyRotationDefault);
			SerializeProperty(writer, "anisotropyStrength", _anisotropyStrength, _anisotropyStrengthDefault);
			SerializePropertyObject(writer, "anisotropyTexture", _anisotropyTexture);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "anisotropyRotation": DeserializePropertyValue<MaterialAnisotropy, Double?>(ref reader, this, out _anisotropyRotation); break;
				case "anisotropyStrength": DeserializePropertyValue<MaterialAnisotropy, Double?>(ref reader, this, out _anisotropyStrength); break;
				case "anisotropyTexture": DeserializePropertyValue<MaterialAnisotropy, TextureInfo>(ref reader, this, out _anisotropyTexture); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
