File: BundleSearchJsonContext.BundleSearchResult.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.csproj (aspire)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Aspire.Cli.NuGet
{
    internal sealed partial class BundleSearchJsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.NuGet.BundleSearchResult>? _BundleSearchResult;
        
        /// <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::Aspire.Cli.NuGet.BundleSearchResult> BundleSearchResult
        #nullable enable annotations
        {
            get => _BundleSearchResult ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.NuGet.BundleSearchResult>)Options.GetTypeInfo(typeof(global::Aspire.Cli.NuGet.BundleSearchResult));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.NuGet.BundleSearchResult> Create_BundleSearchResult(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Cli.NuGet.BundleSearchResult>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.NuGet.BundleSearchResult> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Cli.NuGet.BundleSearchResult>
                {
                    ObjectCreator = () => new global::Aspire.Cli.NuGet.BundleSearchResult(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => BundleSearchResultPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Aspire.Cli.NuGet.BundleSearchResult).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = BundleSearchResultSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Cli.NuGet.BundleSearchResult>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] BundleSearchResultPropInit(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<global::System.Collections.Generic.List<global::Aspire.Cli.NuGet.BundlePackageInfo>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.NuGet.BundleSearchResult),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.NuGet.BundleSearchResult)obj).Packages,
                Setter = static (obj, value) => ((global::Aspire.Cli.NuGet.BundleSearchResult)obj).Packages = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Packages",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Cli.NuGet.BundleSearchResult).GetProperty("Packages", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.List<global::Aspire.Cli.NuGet.BundlePackageInfo>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.List<global::Aspire.Cli.NuGet.BundlePackageInfo>>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.NuGet.BundleSearchResult),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.NuGet.BundleSearchResult)obj).TotalHits,
                Setter = static (obj, value) => ((global::Aspire.Cli.NuGet.BundleSearchResult)obj).TotalHits = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "TotalHits",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Cli.NuGet.BundleSearchResult).GetProperty("TotalHits", 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 BundleSearchResultSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Cli.NuGet.BundleSearchResult? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WritePropertyName(PropName_packages);
            ListBundlePackageInfoSerializeHandler(writer, ((global::Aspire.Cli.NuGet.BundleSearchResult)value).Packages);
            writer.WriteNumber(PropName_totalHits, ((global::Aspire.Cli.NuGet.BundleSearchResult)value).TotalHits);
 
            writer.WriteEndObject();
        }
    }
}