File: OtlpJsonSerializerContext.ResourceInfo.g.cs
Project: src\src\Aspire.Dashboard\Aspire.Dashboard.csproj (Aspire.Dashboard)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Aspire.Dashboard.Otlp.Model.Serialization
{
    internal sealed partial class OtlpJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Api.ResourceInfo>? _ResourceInfo;
        
        /// <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.Dashboard.Api.ResourceInfo> ResourceInfo
        #nullable enable annotations
        {
            get => _ResourceInfo ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Api.ResourceInfo>)Options.GetTypeInfo(typeof(global::Aspire.Dashboard.Api.ResourceInfo));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Api.ResourceInfo> Create_ResourceInfo(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Dashboard.Api.ResourceInfo>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Api.ResourceInfo> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Dashboard.Api.ResourceInfo>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Aspire.Dashboard.Api.ResourceInfo(){ Name = (string)args[0], InstanceId = (string)args[1], DisplayName = (string)args[2], HasLogs = (bool)args[3], HasTraces = (bool)args[4], HasMetrics = (bool)args[5] },
                    PropertyMetadataInitializer = _ => ResourceInfoPropInit(options),
                    ConstructorParameterMetadataInitializer = ResourceInfoCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = ResourceInfoSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Dashboard.Api.ResourceInfo>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ResourceInfoPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[6];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).Name,
                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 = "Name",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).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);
            properties[0].IsRequired = true;
            properties[0].IsGetNullable = false;
            properties[0].IsSetNullable = false;
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).InstanceId,
                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 = "InstanceId",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetProperty("InstanceId", 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<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).DisplayName,
                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 = "DisplayName",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetProperty("DisplayName", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
            properties[2].IsRequired = true;
            properties[2].IsGetNullable = false;
            properties[2].IsSetNullable = false;
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).HasLogs,
                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 = "HasLogs",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetProperty("HasLogs", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info3);
 
            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).HasTraces,
                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 = "HasTraces",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetProperty("HasTraces", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info4);
 
            var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Api.ResourceInfo),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Api.ResourceInfo)obj).HasMetrics,
                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 = "HasMetrics",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Aspire.Dashboard.Api.ResourceInfo).GetProperty("HasMetrics", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info5);
 
            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 ResourceInfoSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Dashboard.Api.ResourceInfo? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            string __value_Name = ((global::Aspire.Dashboard.Api.ResourceInfo)value).Name;
            if (__value_Name is not null)
            {
                writer.WriteString(PropName_name, __value_Name);
            }
            string __value_InstanceId = ((global::Aspire.Dashboard.Api.ResourceInfo)value).InstanceId;
            if (__value_InstanceId is not null)
            {
                writer.WriteString(PropName_instanceId, __value_InstanceId);
            }
            string __value_DisplayName = ((global::Aspire.Dashboard.Api.ResourceInfo)value).DisplayName;
            if (__value_DisplayName is not null)
            {
                writer.WriteString(PropName_displayName, __value_DisplayName);
            }
            writer.WriteBoolean(PropName_hasLogs, ((global::Aspire.Dashboard.Api.ResourceInfo)value).HasLogs);
            writer.WriteBoolean(PropName_hasTraces, ((global::Aspire.Dashboard.Api.ResourceInfo)value).HasTraces);
            writer.WriteBoolean(PropName_hasMetrics, ((global::Aspire.Dashboard.Api.ResourceInfo)value).HasMetrics);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] ResourceInfoCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Name",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "InstanceId",
                ParameterType = typeof(string),
                Position = 1,
                IsNullable = true,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "DisplayName",
                ParameterType = typeof(string),
                Position = 2,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "HasLogs",
                ParameterType = typeof(bool),
                Position = 3,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "HasTraces",
                ParameterType = typeof(bool),
                Position = 4,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "HasMetrics",
                ParameterType = typeof(bool),
                Position = 5,
                IsNullable = false,
                IsMemberInitializer = true,
            },
        };
    }
}