Backend/e-suite.Workflow.Core/Interfaces/ITask.cs

50 lines
1.6 KiB
C#

using e_suite.Database.Core.Tables.Activity;
using e_suite.Workflow.Core.Attributes;
namespace e_suite.Workflow.Core.Interfaces;
[TaskCapability]
public interface ITask
{
/// <summary>
/// The guid identifying this task.
/// </summary>
Guid Guid { get; set; }
/// <summary>
/// ID of the parent of this task. It could be either a Task or a Workflow.
/// </summary>
ITask Parent { get; set; }
/// <summary>
/// Name of the task as seen by users, must be unique in the workflow.
/// </summary>
string Name { get; set; }
/// <summary>
/// Description of the task
/// </summary>
string Description { get; set; }
/// <summary>
/// alloted duration of this item.
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// Called when the task status has been progressed from Pending to Active.
///
/// Note: You can use this method to set the TaskStatus to ReadyToComplete if there is no manual processing needed for this task.
/// After this method is completed, the TaskStatus must be either Active or ReadyToComplete.
/// </summary>
/// <returns></returns>
public Task OnStartedAsync(ActivityTask activityTask);
/// <summary>
/// Called when the task status has been progressed from ReadyToComplete to Completed
/// </summary>
/// <returns>True when the task completes successfully, false when it is considered failed.</returns>
public Task OnCompleteAsync(ActivityTask activityTask);
//Todo add support for events (soap, rest, sftp, e-mail)
}