// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
using Microsoft.Extensions.AI;
namespace Microsoft.Agents.AI.DurableTask.State;
///
/// Represents the function result content for a durable agent state response.
///
internal sealed class DurableAgentStateFunctionResultContent : DurableAgentStateContent
{
///
/// Gets the function call identifier.
///
///
/// This is used to correlate this function result with its originating
/// .
///
[JsonPropertyName("callId")]
public required string CallId { get; init; }
///
/// Gets the function result.
///
[JsonPropertyName("result")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public object? Result { get; init; }
///
/// Creates a from a .
///
/// The to convert.
/// A representing the original content.
public static DurableAgentStateFunctionResultContent FromFunctionResultContent(FunctionResultContent content)
{
return new DurableAgentStateFunctionResultContent()
{
CallId = content.CallId,
Result = content.Result
};
}
///
public override AIContent ToAIContent()
{
return new FunctionResultContent(this.CallId, this.Result);
}
}