File: Generated\361d1da7f942c932\TestTypesContext.RecordWithOptionalParameters.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.JsonSchemaExporter
{
    public static partial class TestTypes
    {
        public partial class TestTypesContext
        {
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters>? _RecordWithOptionalParameters;
            
            /// <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.RecordWithOptionalParameters> RecordWithOptionalParameters
            #nullable enable annotations
            {
                get => _RecordWithOptionalParameters ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters));
            }
            
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters> Create_RecordWithOptionalParameters(global::System.Text.Json.JsonSerializerOptions options)
            {
                if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters> jsonTypeInfo))
                {
                    var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters>
                    {
                        ObjectCreator = null,
                        ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters((int)args[0], (string)args[1], (bool)args[2], (double)args[3], (global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum)args[4], (int)args[5], (string)args[6], (bool)args[7], (double)args[8], (global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum)args[9]),
                        PropertyMetadataInitializer = _ => RecordWithOptionalParametersPropInit(options),
                        ConstructorParameterMetadataInitializer = RecordWithOptionalParametersCtorParamInit,
                        ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(int), typeof(string), typeof(bool), typeof(double), typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum), typeof(int), typeof(string), typeof(bool), typeof(double), typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum)}, modifiers: null),
                        SerializeHandler = RecordWithOptionalParametersSerializeHandler,
                    };
                    
                    jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters>(options, objectInfo);
                    jsonTypeInfo.NumberHandling = null;
                }
            
                jsonTypeInfo.OriginatingResolver = this;
                return jsonTypeInfo;
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] RecordWithOptionalParametersPropInit(global::System.Text.Json.JsonSerializerOptions options)
            {
                var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[10];
 
                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.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).X1,
                    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 = "X1",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("X1", 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<string>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).X2,
                    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 = "X2",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("X2", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
                properties[1].IsGetNullable = false;
                properties[1].IsSetNullable = false;
 
                var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).X3,
                    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 = "X3",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("X3", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info2);
 
                var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<double>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).X4,
                    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 = "X4",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("X4", InstanceMemberBindingFlags, null, typeof(double), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<double>(options, info3);
 
                var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).X5,
                    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 = "X5",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("X5", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum>(options, info4);
 
                var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).Y1,
                    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 = "Y1",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("Y1", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info5);
 
                var info6 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).Y2,
                    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 = "Y2",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("Y2", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info6);
                properties[6].IsGetNullable = false;
                properties[6].IsSetNullable = false;
 
                var info7 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).Y3,
                    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 = "Y3",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("Y3", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info7);
 
                var info8 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<double>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).Y4,
                    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 = "Y4",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("Y4", InstanceMemberBindingFlags, null, typeof(double), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[8] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<double>(options, info8);
 
                var info9 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters),
                    Converter = null,
                    Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)obj).Y5,
                    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 = "Y5",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters).GetProperty("Y5", InstanceMemberBindingFlags, null, typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[9] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum>(options, info9);
 
                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 RecordWithOptionalParametersSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters? value)
            {
                if (value is null)
                {
                    writer.WriteNullValue();
                    return;
                }
                
                writer.WriteStartObject();
 
                writer.WriteNumber(PropName_X1, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).X1);
                writer.WriteString(PropName_X2, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).X2);
                writer.WriteBoolean(PropName_X3, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).X3);
                writer.WriteNumber(PropName_X4, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).X4);
                writer.WritePropertyName(PropName_X5);
                global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).X5, StringEnum);
                writer.WriteNumber(PropName_Y1, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).Y1);
                writer.WriteString(PropName_Y2, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).Y2);
                writer.WriteBoolean(PropName_Y3, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).Y3);
                writer.WriteNumber(PropName_Y4, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).Y4);
                writer.WritePropertyName(PropName_Y5);
                global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.RecordWithOptionalParameters)value).Y5, StringEnum);
 
                writer.WriteEndObject();
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] RecordWithOptionalParametersCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
            {
                new()
                {
                    Name = "X1",
                    ParameterType = typeof(int),
                    Position = 0,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "X2",
                    ParameterType = typeof(string),
                    Position = 1,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "X3",
                    ParameterType = typeof(bool),
                    Position = 2,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "X4",
                    ParameterType = typeof(double),
                    Position = 3,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "X5",
                    ParameterType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum),
                    Position = 4,
                    HasDefaultValue = false,
                    DefaultValue = null,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Y1",
                    ParameterType = typeof(int),
                    Position = 5,
                    HasDefaultValue = true,
                    DefaultValue = (int)(42),
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Y2",
                    ParameterType = typeof(string),
                    Position = 6,
                    HasDefaultValue = true,
                    DefaultValue = "str",
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Y3",
                    ParameterType = typeof(bool),
                    Position = 7,
                    HasDefaultValue = true,
                    DefaultValue = true,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Y4",
                    ParameterType = typeof(double),
                    Position = 8,
                    HasDefaultValue = true,
                    DefaultValue = 0D,
                    IsNullable = false,
                },
 
                new()
                {
                    Name = "Y5",
                    ParameterType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum),
                    Position = 9,
                    HasDefaultValue = true,
                    DefaultValue = (global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.StringEnum)(0),
                    IsNullable = false,
                },
            };
        }
    }
}