File: GenAIMessagesContext.ChatMessage.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.Model.GenAI
{
    public sealed partial class GenAIMessagesContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage>? _ChatMessage;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage> ChatMessage
        {
            get => _ChatMessage ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage>)Options.GetTypeInfo(typeof(global::Aspire.Dashboard.Model.GenAI.ChatMessage));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage> Create_ChatMessage(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Dashboard.Model.GenAI.ChatMessage>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Dashboard.Model.GenAI.ChatMessage>
                {
                    ObjectCreator = () => new global::Aspire.Dashboard.Model.GenAI.ChatMessage(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => ChatMessagePropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    SerializeHandler = ChatMessageSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Dashboard.Model.GenAI.ChatMessage>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ChatMessagePropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Model.GenAI.ChatMessage),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).Role,
                Setter = static (obj, value) => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).Role = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Role",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.List<global::Aspire.Dashboard.Model.GenAI.MessagePart>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Model.GenAI.ChatMessage),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).Parts,
                Setter = static (obj, value) => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).Parts = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Parts",
                JsonPropertyName = null
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.List<global::Aspire.Dashboard.Model.GenAI.MessagePart>>(options, info1);
 
            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Aspire.Dashboard.Model.GenAI.ChatMessage),
                Converter = null,
                Getter = static obj => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).FinishReason,
                Setter = static (obj, value) => ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)obj).FinishReason = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "FinishReason",
                JsonPropertyName = null
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
 
            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 ChatMessageSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Dashboard.Model.GenAI.ChatMessage? value)
        {
            if (value == null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            string __value_Role = ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)value).Role;
            if (__value_Role != null)
            {
                writer.WriteString(PropName_role, __value_Role);
            }
            global::System.Collections.Generic.List<global::Aspire.Dashboard.Model.GenAI.MessagePart> __value_Parts = ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)value).Parts;
            if (__value_Parts != null)
            {
                writer.WritePropertyName(PropName_parts);
                ListMessagePartSerializeHandler(writer, __value_Parts);
            }
            string __value_FinishReason = ((global::Aspire.Dashboard.Model.GenAI.ChatMessage)value).FinishReason;
            if (__value_FinishReason != null)
            {
                writer.WriteString(PropName_finish_reason, __value_FinishReason);
            }
 
            writer.WriteEndObject();
        }
    }
}