// <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.Tiles3D
{
	using Collections;

	/// <summary>
	/// Feature IDs stored in a GPU mesh instancing attribute
	/// </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 MeshExtInstanceFeatureID : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "featureId";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "attribute";
			yield return "featureCount";
			yield return "label";
			yield return "nullFeatureId";
			yield return "propertyTable";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "attribute": value = FIELDINFO.From("attribute",this, instance => instance._attribute); return true;
				case "featureCount": value = FIELDINFO.From("featureCount",this, instance => instance._featureCount); return true;
				case "label": value = FIELDINFO.From("label",this, instance => instance._label); return true;
				case "nullFeatureId": value = FIELDINFO.From("nullFeatureId",this, instance => instance._nullFeatureId); return true;
				case "propertyTable": value = FIELDINFO.From("propertyTable",this, instance => instance._propertyTable); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private Int32? _attribute;
		
		private const Int32 _featureCountMinimum = 1;
		private Int32 _featureCount;
		
		private String _label;
		
		private const Int32 _nullFeatureIdMinimum = 0;
		private Int32? _nullFeatureId;
		
		private const Int32 _propertyTableMinimum = 0;
		private Int32? _propertyTable;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "attribute", _attribute);
			SerializeProperty(writer, "featureCount", _featureCount);
			SerializeProperty(writer, "label", _label);
			SerializeProperty(writer, "nullFeatureId", _nullFeatureId);
			SerializeProperty(writer, "propertyTable", _propertyTable);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "attribute": DeserializePropertyValue<MeshExtInstanceFeatureID, Int32?>(ref reader, this, out _attribute); break;
				case "featureCount": DeserializePropertyValue<MeshExtInstanceFeatureID, Int32>(ref reader, this, out _featureCount); break;
				case "label": DeserializePropertyValue<MeshExtInstanceFeatureID, String>(ref reader, this, out _label); break;
				case "nullFeatureId": DeserializePropertyValue<MeshExtInstanceFeatureID, Int32?>(ref reader, this, out _nullFeatureId); break;
				case "propertyTable": DeserializePropertyValue<MeshExtInstanceFeatureID, Int32?>(ref reader, this, out _propertyTable); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

	/// <summary>
	/// An object describing per-instance feature IDs.
	/// </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 MeshExtInstanceFeatures : ExtraProperties
	{
	
		#region reflection
	
		public new const string SCHEMANAME = "EXT_instance_features";
		protected override string GetSchemaName() => SCHEMANAME;
	
		protected override IEnumerable<string> ReflectFieldsNames()
		{
			yield return "featureIds";
			foreach(var f in base.ReflectFieldsNames()) yield return f;
		}
		protected override bool TryReflectField(string name, out FIELDINFO value)
		{
			switch(name)
			{
				case "featureIds": value = FIELDINFO.From("featureIds",this, instance => instance._featureIds); return true;
				default: return base.TryReflectField(name, out value);
			}
		}
	
		#endregion
	
		#region data
	
		private const int _featureIdsMinItems = 1;
		private ChildrenList<MeshExtInstanceFeatureID,MeshExtInstanceFeatures> _featureIds;
		
		#endregion
	
		#region serialization
	
		protected override void SerializeProperties(JSONWRITER writer)
		{
			base.SerializeProperties(writer);
			SerializeProperty(writer, "featureIds", _featureIds, _featureIdsMinItems);
		}
	
		protected override void DeserializeProperty(string jsonPropertyName, ref JSONREADER reader)
		{
			switch (jsonPropertyName)
			{
				case "featureIds": DeserializePropertyList<MeshExtInstanceFeatures, MeshExtInstanceFeatureID>(ref reader, this, _featureIds); break;
				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
			}
		}
	
		#endregion
	
	}

}
