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

namespace Quadarax.Foundation.Core.Business.Processor.Queue
{
    #region *** Callback delegates ***
    public delegate void ItemProcessedCallback(ITaskItem item);
    public delegate void ItemAddedCallback(ITaskItem item);
    public delegate void ProcessorStartedCallback(ITaskItem item);
    public delegate void ProcessorStoppedCallback(ITaskItem item);
    public delegate void ProcessorErrorCallback(string message, Exception? e);
    #endregion

    public class CallbackDelegates
    {
        #region *** Public properties ***
        public ItemProcessedCallback? OnItemProcessed { get; set; }
        public ItemAddedCallback? OnItemAdded { get; set; }
        public ProcessorStartedCallback? OnProcessorStarted { get; set; }
        public ProcessorStoppedCallback? OnProcessorStopped { get; set; }
        public ProcessorErrorCallback? OnProcessorError { get; set; }
        #endregion

        #region *** Constructors ***
        public CallbackDelegates()
        {
        }
        #endregion

        #region *** Public operations ***

        public void Reset()
        {
            OnItemProcessed = null;
            OnItemAdded = null;
            OnProcessorStarted = null;
            OnProcessorStopped = null;
            OnProcessorError = null;
        }
        #endregion
    }
}
