// Copyright (c) Microsoft. All rights reserved. using System.Text.Json.Serialization; using Microsoft.Extensions.AI; namespace Microsoft.Agents.AI.DurableTask.State; /// /// Represents durable agent state content that contains error content. /// internal sealed class DurableAgentStateErrorContent : DurableAgentStateContent { /// /// Gets the error message. /// [JsonPropertyName("message")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? Message { get; init; } /// /// Gets the error code. /// [JsonPropertyName("errorCode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? ErrorCode { get; init; } /// /// Gets the error details. /// [JsonPropertyName("details")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? Details { get; init; } /// /// Creates a from an . /// /// The to convert. /// A representing the original /// . public static DurableAgentStateErrorContent FromErrorContent(ErrorContent content) { return new DurableAgentStateErrorContent() { Details = content.Details, ErrorCode = content.ErrorCode, Message = content.Message }; } /// public override AIContent ToAIContent() { return new ErrorContent(this.Message) { Details = this.Details, ErrorCode = this.ErrorCode }; } }