File: BackchannelJsonSerializerContext.Icon.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.Backchannel
{
    internal partial class BackchannelJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ModelContextProtocol.Protocol.Icon>? _Icon;
        
        /// <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::ModelContextProtocol.Protocol.Icon> Icon
        #nullable enable annotations
        {
            get => _Icon ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ModelContextProtocol.Protocol.Icon>)Options.GetTypeInfo(typeof(global::ModelContextProtocol.Protocol.Icon));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ModelContextProtocol.Protocol.Icon> Create_Icon(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::ModelContextProtocol.Protocol.Icon>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ModelContextProtocol.Protocol.Icon> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::ModelContextProtocol.Protocol.Icon>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::ModelContextProtocol.Protocol.Icon(){ Source = (string)args[0], MimeType = (string)args[1], Sizes = (global::System.Collections.Generic.IList<string>)args[2], Theme = (string)args[3] },
                    PropertyMetadataInitializer = _ => IconPropInit(options),
                    ConstructorParameterMetadataInitializer = IconCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Icon).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = IconSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::ModelContextProtocol.Protocol.Icon>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] IconPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[4];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::ModelContextProtocol.Protocol.Icon),
                Converter = null,
                Getter = static obj => ((global::ModelContextProtocol.Protocol.Icon)obj).Source,
                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 = "Source",
                JsonPropertyName = "src",
                AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Icon).GetProperty("Source", 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::ModelContextProtocol.Protocol.Icon),
                Converter = null,
                Getter = static obj => ((global::ModelContextProtocol.Protocol.Icon)obj).MimeType,
                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 = "MimeType",
                JsonPropertyName = "mimeType",
                AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Icon).GetProperty("MimeType", 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<global::System.Collections.Generic.IList<string>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::ModelContextProtocol.Protocol.Icon),
                Converter = null,
                Getter = static obj => ((global::ModelContextProtocol.Protocol.Icon)obj).Sizes,
                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 = "Sizes",
                JsonPropertyName = "sizes",
                AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Icon).GetProperty("Sizes", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.IList<string>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.IList<string>>(options, info2);
 
            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::ModelContextProtocol.Protocol.Icon),
                Converter = null,
                Getter = static obj => ((global::ModelContextProtocol.Protocol.Icon)obj).Theme,
                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 = "Theme",
                JsonPropertyName = "theme",
                AttributeProviderFactory = static () => typeof(global::ModelContextProtocol.Protocol.Icon).GetProperty("Theme", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info3);
 
            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 IconSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::ModelContextProtocol.Protocol.Icon? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteString(PropName_src, ((global::ModelContextProtocol.Protocol.Icon)value).Source);
            writer.WriteString(PropName_mimeType, ((global::ModelContextProtocol.Protocol.Icon)value).MimeType);
            writer.WritePropertyName(PropName_sizes);
            IListStringSerializeHandler(writer, ((global::ModelContextProtocol.Protocol.Icon)value).Sizes);
            writer.WriteString(PropName_theme, ((global::ModelContextProtocol.Protocol.Icon)value).Theme);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] IconCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "Source",
                ParameterType = typeof(string),
                Position = 0,
                IsNullable = false,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "MimeType",
                ParameterType = typeof(string),
                Position = 1,
                IsNullable = true,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "Sizes",
                ParameterType = typeof(global::System.Collections.Generic.IList<string>),
                Position = 2,
                IsNullable = true,
                IsMemberInitializer = true,
            },
 
            new()
            {
                Name = "Theme",
                ParameterType = typeof(string),
                Position = 3,
                IsNullable = true,
                IsMemberInitializer = true,
            },
        };
    }
}