File: BackchannelJsonSerializerContext.RpcResourceState.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.Tool.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.Backchannel
{
    internal partial class BackchannelJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.RpcResourceState>? _RpcResourceState;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.RpcResourceState> RpcResourceState
        {
            get => _RpcResourceState ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.RpcResourceState>)Options.GetTypeInfo(typeof(global::Aspire.Cli.Backchannel.RpcResourceState));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.RpcResourceState> Create_RpcResourceState(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Cli.Backchannel.RpcResourceState>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.RpcResourceState> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Cli.Backchannel.RpcResourceState>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::Aspire.Cli.Backchannel.RpcResourceState(){ Resource = (string)args[0], Type = (string)args[1], State = (string)args[2], Endpoints = (string[])args[3], Health = (string)args[4] },
                    PropertyMetadataInitializer = _ => RpcResourceStatePropInit(options),
                    ConstructorParameterMetadataInitializer = RpcResourceStateCtorParamInit,
                    SerializeHandler = RpcResourceStateSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Cli.Backchannel.RpcResourceState>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] RpcResourceStatePropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[5];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.Backchannel.RpcResourceState),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.RpcResourceState)obj).Resource,
                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 = "Resource",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
            properties[0].IsRequired = true;
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.Backchannel.RpcResourceState),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.RpcResourceState)obj).Type,
                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 = "Type",
                JsonPropertyName = null
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
            properties[1].IsRequired = true;
 
            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.Backchannel.RpcResourceState),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.RpcResourceState)obj).State,
                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 = "State",
                JsonPropertyName = null
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
            properties[2].IsRequired = true;
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string[]>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.Backchannel.RpcResourceState),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.RpcResourceState)obj).Endpoints,
                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 = "Endpoints",
                JsonPropertyName = null
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string[]>(options, info3);
            properties[3].IsRequired = true;
 
            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Cli.Backchannel.RpcResourceState),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.RpcResourceState)obj).Health,
                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 = "Health",
                JsonPropertyName = null
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info4);
 
            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 RpcResourceStateSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Cli.Backchannel.RpcResourceState? value)
        {
            if (value == null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteString(PropName_Resource, ((global::Aspire.Cli.Backchannel.RpcResourceState)value).Resource);
            writer.WriteString(PropName_Type, ((global::Aspire.Cli.Backchannel.RpcResourceState)value).Type);
            writer.WriteString(PropName_State, ((global::Aspire.Cli.Backchannel.RpcResourceState)value).State);
            writer.WritePropertyName(PropName_Endpoints);
            StringArraySerializeHandler(writer, ((global::Aspire.Cli.Backchannel.RpcResourceState)value).Endpoints);
            writer.WriteString(PropName_Health, ((global::Aspire.Cli.Backchannel.RpcResourceState)value).Health);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] RpcResourceStateCtorParamInit()
        {
            var parameters = new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[5];
 
            parameters[0] = new()
            {
                Name = "Resource",
                ParameterType = typeof(string),
                Position = 0,
            };
            
            parameters[1] = new()
            {
                Name = "Type",
                ParameterType = typeof(string),
                Position = 1,
            };
            
            parameters[2] = new()
            {
                Name = "State",
                ParameterType = typeof(string),
                Position = 2,
            };
            
            parameters[3] = new()
            {
                Name = "Endpoints",
                ParameterType = typeof(string[]),
                Position = 3,
            };
            
            parameters[4] = new()
            {
                Name = "Health",
                ParameterType = typeof(string),
                Position = 4,
            };
            
            return parameters;
        }
    }
}