namespace Quadarax.Foundation.Core.Business.Processor.Task;

public interface IAffinityToken : IEquatable<AffinityToken>
{
    /// <summary>
    /// Contains the queue identifier which is used to identify owning/locking queue.
    /// </summary>
    string QueueIdentifier { get; }
    /// <summary>
    /// Contains the worker ordinal which is used to identify owning/locking worker.
    /// </summary>
    int? WorkerOrdinal { get; }
    /// <summary>
    /// Setup affinity token from complex string representation.
    /// </summary>
    /// <param name="affinityTokenComplex">Complex affinity token representation</param>
    void FromComplex(string affinityTokenComplex);
    /// <summary>
    /// Setup affinity token from queue identifier and worker ordinal.
    /// </summary>
    /// <param name="queueIdentifier">queue identifier</param>
    /// <param name="workerOrdinal">Worker ordinal number</param>
    void Set(string queueIdentifier, int workerOrdinal);
    string ToString();
}