// <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.StringOrIntUnion>? _StringOrIntUnion;
        
        /// <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.StringOrIntUnion> StringOrIntUnion
        #nullable enable annotations
        {
            get => _StringOrIntUnion ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.StringOrIntUnion>)Options.GetTypeInfo(typeof(global::TestApp.StringOrIntUnion));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.StringOrIntUnion> Create_StringOrIntUnion(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::TestApp.StringOrIntUnion>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::TestApp.StringOrIntUnion> jsonTypeInfo))
            {
                var unionInfo = new global::System.Text.Json.Serialization.Metadata.JsonUnionInfoValues<global::TestApp.StringOrIntUnion>
                {
                    UnionCases = new global::System.Text.Json.Serialization.Metadata.JsonUnionCaseInfo[] { new global::System.Text.Json.Serialization.Metadata.JsonUnionCaseInfo(typeof(int)) { IsNullable = false }, new global::System.Text.Json.Serialization.Metadata.JsonUnionCaseInfo(typeof(string)) { IsNullable = true } },
                    UnionConstructor = static (global::System.Type _, object? value) => value switch
                    {
                        int caseValue0 => new global::TestApp.StringOrIntUnion(caseValue0),
                        string caseValue1 => new global::TestApp.StringOrIntUnion(caseValue1),
                        null => new global::TestApp.StringOrIntUnion((string?)null),
                        _ => throw new global::System.Text.Json.JsonException(),
                    },
                    UnionDeconstructor = static (global::TestApp.StringOrIntUnion value) =>
                    {
                        return value switch
                        {
                            null => (typeof(string), (object?)null),
                            int caseValue0 => (typeof(int), (object?)caseValue0),
                            string caseValue1 => (typeof(string), (object?)caseValue1),
                        };
                    },
                    TypeClassifier = null,
                    TypeClassifierFactory = null,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateUnionInfo<global::TestApp.StringOrIntUnion>(options, unionInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
    }
}
