using Quadarax.Foundation.Core.Business.Processor.Enums;
namespace Quadarax.Foundation.Core.Business.Processor.Task;
public interface ITaskItem : ITaskIdentifier, ITimeTracked
{
#region *** Properties ***
///
/// Contains the affinity token which is used to identify owning/locking queue.
///
IAffinityToken AffinityToken { get; }
///
/// External reference of the task.
///
public string Reference { get; }
///
/// Status of the task.
///
public ProcessStatusEnum Status { get; }
///
/// Assembly qualified name of the provider class responsible to process task.
///
public string ProviderClass { get; }
///
/// Task priority value (0-maximal, 255-minimal / default 100).
///
public byte Priority { get; }
///
/// Time when task can be processed.
///
public DateTime ProcessingValidFrom { get; }
///
/// Time when task will be expired.
///
public DateTime? ProcessingValidTo { get; }
///
/// Decremental counter of attempts to try process task.
///
public int AttemptsLeft { get; }
///
/// Statistical timestamp when task begins to process.
///
public DateTime StatStarted { get; }
///
/// Statistical timestamp when task finished.
///
public DateTime StatFinished { get; }
///
/// Latest attempt duration
///
public TimeSpan StatLastAttemptDuration { get; }
#endregion
#region *** Operations ***
///
/// Schedules task to future and sets to (affects and ).
///
/// - Allowed state: ,
/// - Set state to:
///
///
/// Interval to shift to future.
/// Reason message to postpone.
void Postpone(TimeSpan postponeInterval, string reason);
void Stop(string reason);
void Reset(string reason);
#endregion
}