// <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.ByRefParams>? _ByRefParams;
        
        /// <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.ByRefParams> ByRefParams
        #nullable enable annotations
        {
            get => _ByRefParams ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.ByRefParams>)Options.GetTypeInfo(typeof(global::TestApp.ByRefParams));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.ByRefParams> Create_ByRefParams(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::TestApp.ByRefParams>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.ByRefParams> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::TestApp.ByRefParams>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => { var __temp1 = (string)args[1]; return new global::TestApp.ByRefParams((global::System.DateTime)args[0], ref __temp1, out var __discard2); },
                    PropertyMetadataInitializer = _ => ByRefParamsPropInit(options),
                    ConstructorParameterMetadataInitializer = ByRefParamsCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::TestApp.ByRefParams).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.DateTime), typeof(string), typeof(int)}, modifiers: null),
                    SerializeHandler = ByRefParamsSerializeHandler,
                    PolymorphismOptions = new global::System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions(),
                    TypeClassifierFactory = null,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::TestApp.ByRefParams>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

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

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::TestApp.ByRefParams),
                Converter = null,
                Getter = static obj => ((global::TestApp.ByRefParams)obj).Name,
                Setter = static (obj, value) => ((global::TestApp.ByRefParams)obj).Name = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Name",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::TestApp.ByRefParams).GetProperty("Name", 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);

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

            writer.WriteString(PropName_Date, ((global::TestApp.ByRefParams)value).Date);
            writer.WriteString(PropName_Name, ((global::TestApp.ByRefParams)value).Name);
            writer.WriteNumber(PropName_Result, ((global::TestApp.ByRefParams)value).Result);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] ByRefParamsCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "date",
                ParameterType = typeof(global::System.DateTime),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "name",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = true,
            },
        };
    }
}
