// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace TestApp
{
    internal partial class MyContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.PrivateProps>? _PrivateProps;
        
        /// <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::TestApp.PrivateProps> PrivateProps
        #nullable enable annotations
        {
            get => _PrivateProps ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.PrivateProps>)Options.GetTypeInfo(typeof(global::TestApp.PrivateProps));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.PrivateProps> Create_PrivateProps(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::TestApp.PrivateProps>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.PrivateProps> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::TestApp.PrivateProps>
                {
                    ObjectCreator = () => new global::TestApp.PrivateProps(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => PrivatePropsPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = static () => typeof(global::TestApp.PrivateProps).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = PrivatePropsSerializeHandler,
                    PolymorphismOptions = new global::System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions(),
                    TypeClassifierFactory = null,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::TestApp.PrivateProps>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PrivatePropsPropInit(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<string>
            {
                IsProperty = true,
                IsPublic = false,
                IsVirtual = false,
                DeclaringType = typeof(global::TestApp.PrivateProps),
                Converter = null,
                Getter = static obj => __get_PrivateProps_Name((global::TestApp.PrivateProps)obj),
                Setter = static (obj, value) => __set_PrivateProps_Name((global::TestApp.PrivateProps)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = true,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Name",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::TestApp.PrivateProps).GetProperty("Name", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = false,
                IsVirtual = false,
                DeclaringType = typeof(global::TestApp.PrivateProps),
                Converter = null,
                Getter = static obj => __get_PrivateProps_Age((global::TestApp.PrivateProps)obj),
                Setter = static (obj, value) => __set_PrivateProps_Age((global::TestApp.PrivateProps)obj, value!),
                IgnoreCondition = null,
                HasJsonInclude = true,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Age",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::TestApp.PrivateProps).GetProperty("Age", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(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 PrivatePropsSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::TestApp.PrivateProps? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_Name, __get_PrivateProps_Name(((global::TestApp.PrivateProps)value)));
            writer.WriteNumber(PropName_Age, __get_PrivateProps_Age(((global::TestApp.PrivateProps)value)));

            writer.WriteEndObject();
        }

        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "get_Name")]
        private static extern string __get_PrivateProps_Name(global::TestApp.PrivateProps obj);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Name")]
        private static extern void __set_PrivateProps_Name(global::TestApp.PrivateProps obj, string value);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "get_Age")]
        private static extern int __get_PrivateProps_Age(global::TestApp.PrivateProps obj);
        [global::System.Runtime.CompilerServices.UnsafeAccessorAttribute(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_Age")]
        private static extern void __set_PrivateProps_Age(global::TestApp.PrivateProps obj, int value);
    }
}
