File: Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.MyPoco.g.cs
Project: ..\..\..\test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Microsoft.Extensions.AI.Abstractions.Tests.csproj (Microsoft.Extensions.AI.Abstractions.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
{
    public static partial class AIJsonUtilitiesTests
    {
        private partial class JsonContext
        {
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco>? _MyPoco;
            
            /// <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.AIJsonUtilitiesTests.MyPoco> MyPoco
            #nullable enable annotations
            {
                get => _MyPoco ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco));
            }
            
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco> Create_MyPoco(global::System.Text.Json.JsonSerializerOptions options)
            {
                if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco> jsonTypeInfo))
                {
                    var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco>
                    {
                        ObjectCreator = null,
                        ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco((int)args[0], (global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyEnumValue)args[1], (string)args[2]),
                        PropertyMetadataInitializer = _ => MyPocoPropInit(options),
                        ConstructorParameterMetadataInitializer = MyPocoCtorParamInit,
                        ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(int), typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyEnumValue), typeof(string)}, modifiers: null),
                        SerializeHandler = MyPocoSerializeHandler,
                    };
                    
                    jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco>(options, objectInfo);
                    jsonTypeInfo.NumberHandling = null;
                }
            
                jsonTypeInfo.OriginatingResolver = this;
                return jsonTypeInfo;
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] MyPocoPropInit(global::System.Text.Json.JsonSerializerOptions options)
            {
                var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];
 
                var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)obj).Key,
                    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 = "Key",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco).GetProperty("Key", 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.AIJsonUtilitiesTests.MyEnumValue>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)obj).EnumValue,
                    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 = "EnumValue",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco).GetProperty("EnumValue", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyEnumValue), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyEnumValue>(options, info1);
 
                var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)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.AIJsonUtilitiesTests.MyPoco).GetProperty("Value", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
 
                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 MyPocoSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco? value)
            {
                if (value is null)
                {
                    writer.WriteNullValue();
                    return;
                }
                
                writer.WriteStartObject();
 
                writer.WriteNumber(PropName_Key, ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)value).Key);
                writer.WritePropertyName(PropName_EnumValue);
                global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)value).EnumValue, MyEnumValue);
                writer.WriteString(PropName_Value, ((global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyPoco)value).Value);
 
                writer.WriteEndObject();
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] MyPocoCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
            {
                new()
                {
                    Name = "Key",
                    ParameterType = typeof(int),
                    Position = 0,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "EnumValue",
                    ParameterType = typeof(global::Microsoft.Extensions.AI.AIJsonUtilitiesTests.MyEnumValue),
                    Position = 1,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Value",
                    ParameterType = typeof(string),
                    Position = 2,
                    HasDefaultValue = true,
                    DefaultValue = "defaultValue",
                    IsNullable = true,
                },
            };
        }
    }
}