// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.DurableTask.State;
///
/// Represents a single entry in the durable agent state, which can either be a
/// user/system request or agent response.
///
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
[JsonDerivedType(typeof(DurableAgentStateRequest), "request")]
[JsonDerivedType(typeof(DurableAgentStateResponse), "response")]
internal abstract class DurableAgentStateEntry
{
///
/// Gets the correlation ID for this entry.
///
///
/// This ID is used to correlate back to its
/// .
///
[JsonPropertyName("correlationId")]
public required string CorrelationId { get; init; }
///
/// Gets the timestamp when this entry was created.
///
[JsonPropertyName("createdAt")]
public required DateTimeOffset CreatedAt { get; init; }
///
/// Gets the list of messages associated with this entry, in chronological order.
///
[JsonPropertyName("messages")]
public IReadOnlyList Messages { get; init; } = [];
///
/// Gets any additional data found during deserialization that does not map to known properties.
///
[JsonExtensionData]
public IDictionary? ExtensionData { get; set; }
}