File: Generated\361d1da7f942c932\TestTypesContext.PocoWithRecursiveMembers.g.cs
Project: ..\..\..\test\Shared\Shared.Tests.csproj (Shared.Tests)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Microsoft.Extensions.AI.JsonSchemaExporter
{
    public static partial class TestTypes
    {
        public partial class TestTypesContext
        {
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>? _PocoWithRecursiveMembers;
            
            /// <summary>
            /// Defines the source generated JSON serialization contract metadata for a given type.
            /// </summary>
            #nullable disable annotations // Marking the property type as nullable-oblivious.
            public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers> PocoWithRecursiveMembers
            #nullable enable annotations
            {
                get => _PocoWithRecursiveMembers ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers));
            }
            
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers> Create_PocoWithRecursiveMembers(global::System.Text.Json.JsonSerializerOptions options)
            {
                if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers> jsonTypeInfo))
                {
                    var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>
                    {
                        ObjectCreator = null,
                        ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers(){ Value = (int)args[0], Next = (global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers)args[1] },
                        PropertyMetadataInitializer = _ => PocoWithRecursiveMembersPropInit(options),
                        ConstructorParameterMetadataInitializer = PocoWithRecursiveMembersCtorParamInit,
                        ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                        SerializeHandler = PocoWithRecursiveMembersSerializeHandler,
                    };
                    
                    jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>(options, objectInfo);
                    jsonTypeInfo.NumberHandling = null;
                }
            
                jsonTypeInfo.OriginatingResolver = this;
                return jsonTypeInfo;
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PocoWithRecursiveMembersPropInit(global::System.Text.Json.JsonSerializerOptions options)
            {
                var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];
 
                var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers)obj).Value,
                    Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                    IgnoreCondition = null,
                    HasJsonInclude = false,
                    IsExtensionData = false,
                    NumberHandling = null,
                    PropertyName = "Value",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers).GetProperty("Value", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info0);
 
                var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers)obj).Next,
                    Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."),
                    IgnoreCondition = null,
                    HasJsonInclude = false,
                    IsExtensionData = false,
                    NumberHandling = null,
                    PropertyName = "Next",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers).GetProperty("Next", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers>(options, info1);
 
                return properties;
            }
 
            // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
            // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
            private void PocoWithRecursiveMembersSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers? value)
            {
                if (value is null)
                {
                    writer.WriteNullValue();
                    return;
                }
                
                writer.WriteStartObject();
 
                writer.WriteNumber(PropName_Value, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers)value).Value);
                writer.WritePropertyName(PropName_Next);
                PocoWithRecursiveMembersSerializeHandler(writer, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers)value).Next);
 
                writer.WriteEndObject();
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] PocoWithRecursiveMembersCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
            {
                new()
                {
                    Name = "Value",
                    ParameterType = typeof(int),
                    Position = 0,
                    IsNullable = false,
                    IsMemberInitializer = true,
                },
 
                new()
                {
                    Name = "Next",
                    ParameterType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithRecursiveMembers),
                    Position = 1,
                    IsNullable = true,
                    IsMemberInitializer = true,
                },
            };
        }
    }
}