using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Flowsharp.ActivityResults; using Flowsharp.Models; namespace Flowsharp.Activities { public interface IActivity { /// /// Returns a value of whether the specified activity can execute. /// Task CanExecuteAsync(WorkflowExecutionContext workflowContext, ActivityExecutionContext activityContext, CancellationToken cancellationToken); /// /// Executes the specified activity. /// Task ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityExecutionContext activityContext, CancellationToken cancellationToken); /// /// Resumes the specified activity. /// Task ResumeAsync(WorkflowExecutionContext workflowContext, ActivityExecutionContext activityContext, CancellationToken cancellationToken); /// /// Executes before a workflow starts or resumes, giving activities an opportunity to read and store any values of interest. /// Task ReceiveInputAsync(WorkflowExecutionContext workflowContext, IDictionary input, CancellationToken cancellationToken); /// /// Executes when a workflow is about to start. /// Task WorkflowStartingAsync(WorkflowExecutionContext workflowContext, CancellationToken cancellationToken); /// /// Executes when a workflow has started. /// Task WorkflowStartedAsync(WorkflowExecutionContext context, CancellationToken cancellationToken); /// /// Executes when a workflow is about to be resumed. /// Task WorkflowResumingAsync(WorkflowExecutionContext context, CancellationToken cancellationToken); /// /// Executes when a workflow is resumed. /// Task WorkflowResumedAsync(WorkflowExecutionContext context, CancellationToken cancellationToken); /// /// Executes when an activity is about to be executed. /// /// The workflow execution context. /// The activity context containing the activity that is the subject of the event. /// The cancellation token. Task OnActivityExecutingAsync(WorkflowExecutionContext workflowContext, ActivityExecutionContext activityContext, CancellationToken cancellationToken = default(CancellationToken)); /// /// Called on each activity when an activity has been executed. /// /// The workflow execution context. /// The activity context containing the activity that is the subject of the event. /// The cancellation token. Task OnActivityExecutedAsync(WorkflowExecutionContext workflowContext, ActivityExecutionContext activityContext, CancellationToken cancellationToken); } }