// Copyright (c) Microsoft. All rights reserved.
namespace Microsoft.Agents.AI.DurableTask.Workflows;
///
/// Represents a workflow run that can be awaited for completion.
///
///
///
/// This interface extends to provide methods for waiting
/// until the workflow execution completes. Not all workflow runners support this capability.
///
///
/// Use pattern matching to check if a workflow run supports awaiting:
///
/// IWorkflowRun run = await client.RunAsync(workflow, input);
/// if (run is IAwaitableWorkflowRun awaitableRun)
/// {
/// string? result = await awaitableRun.WaitForCompletionAsync<string>();
/// }
///
///
///
public interface IAwaitableWorkflowRun : IWorkflowRun
{
///
/// Waits for the workflow to complete and returns the result.
///
/// The expected result type.
/// A cancellation token to observe.
/// The result of the workflow execution.
/// Thrown when the workflow failed or was terminated.
ValueTask WaitForCompletionAsync(CancellationToken cancellationToken = default);
}